Can someone give me an example of a 2D array in java? Also what is the purpose of using it?
Printable View
Can someone give me an example of a 2D array in java? Also what is the purpose of using it?
Have a look here: Java 2D array examples
Please come on back if still questions after reviewing the above. Best of luck.
are "2d arrays" and "parallel arrays" the same?
No, they are different. Parallel arrays can be 2 dimensional, but usually I think of two or more one-dimensional arrays that hold info that is somehow linked by the indexes. For instance, if you have an array of String holding last names and another array of Strings holding first names and the i-th last name is linked to the i-th first name, that's a parallel array. These are usually not recommended, and much better would be to create a class that holds the two Strings so you can have a single array of objects of this class.Quote:
are "2d arrays" and "parallel arrays" the same?
Thank you ...