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!

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 Arrays

Arrays in Java

Hello everyone, I want to know why in java write short "arr" for Arrrays, e.g. i saw: arr.get (i). Is it something different from Arrays in this lesson?, I'd love to know how it relates to the lesson of the. Thanks alot of your answer :).

1 Answer

Fahad Mutair
Fahad Mutair
10,359 Points

hi Ei 123 , arr is a name of your Array , you can name it whatever you like

String [] arrOne = new String [10]; // the name of your 1st array is arrOne with String type
arrOne.get(i); // to get element in position i from your 1st array named arrOne 
String [] arrTwo = new String [10]; // you can have another array but with different name arrTwo with same type
arrTwo.get(i); // to get access to the second array and get element at i Position

OK, I understand.. Thank you so much for the explanation, it really helped me! :)