Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

ARRAY CHAGING THE SIZE?

I have found this several times in the lattest videos. In minute 5:45, Craig does this:

fruit.toArray(new String[0]);

But the thing is...fruit does not have size 0!

I have seen it in the "Streams lesson to" when he does:

Treet[] treets = new Treet[0]; /* <--- Initializing array with a length of 0 / try ( FileInputStream fis = new FileInputStream("treets.ser"); ObjectInputStream ois = new ObjectInputStream(fis); ) { treets = (Treet[]) ois.readObject(); / <--- casting outputed object to the Treet array */ }

Hey Ricardo,

Which video are you looking at?

Thanks!