Nice explanation. One thing that helped me understand String arrays was seeing the difference between declaring and initializing them.
For example:
String[] names = {"Ali", "Sara", "John"};
Here, Java creates the array and assigns the values at the same time. Just remember that array indexes start from 0, so names[0] is "Ali" and names[1] is "Sara". It’s a simple detail, but easy to forget when you're starting out.
jahanzaib12
Learning, Building, and Sharing Code
Nice explanation. One thing that helped me understand String arrays was seeing the difference between declaring and initializing them.
For example:
Here, Java creates the array and assigns the values at the same time. Just remember that array indexes start from 0, so
names[0]is"Ali"andnames[1]is"Sara". It’s a simple detail, but easy to forget when you're starting out.