Hey guys,
Im new to Java and i am trying to wrap my head around arrays and what not. What i am trying to do is create an array for a puzzle which is 4x4 and has the numbers 1 to 16 so far i have got this
public class Puzzle {
public static void main(String[] args) {
Puzzle[][] puzzle = new Puzzle[4][4];
// print array in rectangular form
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
System.out.print(1+j);
}
System.out.println("");
}
}
}
which gives the output of text
1234
1234
1234
1234
so what i want to be able to do is have:
1,2,3,4
5,6,7,8
9,10,11,12
13,14,15,16
so not sure how to assign the number to the array positions