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 Java Data Structures Organizing Data Serialization

isaac schwartzman
isaac schwartzman
963 Points

why (Treets [] treets) basically why the lower case treet

I don't get this parameter.

2 Answers

Treet[] is the type of the parameter and treets is its name.

Trevor Hunsberger
Trevor Hunsberger
1,509 Points

I assume your talking about the parameter for the save() method in the Treets class? If so, then for starters, Lars Reimann is correct, it should be "save(Treet[] treets)".

Heres why: Inside those parameter parentheses you are defining what data type you want to use, and what name you want to call it by. in this case we want to use an array of Treet objects, so we use (Treet[]...) to tell it to expect an array of Treets. then we need to name the array so we can use it in the method, so we call it treets. and it looks like this (Treet[] treets).

*The reason it's lower case is to distinguish between the name and the datatype itself. * The name, or reference variable, is just something you use to point to the object your talking about. Some examples: method(DataType referenceVariable), compareTo(Object obj), add(int int1, int int2) <<< notice here that int isn't upper case because an int is a primitive data type, and primitives like int float, double, long, etc are not capitalized. but the Integer class is.