Alright so first of all i just signed up to this forum, i am really interested into learning the java programming language however, while reading the official tutorial from their official website (sun.com) i saw this example of a multidimensional array that i can't understand.
Example of program:
class MultiDimArrayDemo { public static void main(String[] args) { String[][] names = {{"Mr. ", "Mrs. ", "Ms. "}, {"Smith", "Jones"}}; System.out.println(names[0][0] + names[1][0]); //Mr. Smith System.out.println(names[0][2] + names[1][1]); //Ms. Jones } }
First of all, why is it claiming both arrays position for every single part, i mean its doing names[0][0] + names[1][0] isn't it supposed to be for example names[0][1] for Mr. Smith ? why do i need to declare both positions of the arrays twice and not once ? i don't understand that small piece of development could anyone please give me a hand ?