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

Two ways:
1: Do some arithmetic using i and j
the first row is 1,2,3,4
The second is 5,6,7,8 which is also 4+1, 4+2, 4+3, 4+4
The third is ... 8+1, 8+2 etc see the pattern?
2: you have a nested loop that you can use to access all the array elements in order (see Majestic's post as well). You need to put 1 in the first, 2 in the second... 16 in the last. You can do this with a simple "counter" variable that starts at 1 and adds 1 each time you use it.

means that each cell in the 4x4 grid is a "Puzzle". So you have 16 "Puzzle" instances. This may not be what you want. You want to have a 4x4 grid of something. What is the thing you want for each cell in the 4x4 grid?

No. What they want is to learn Java, not just get their homework done for them ready to
copy/paste. Why do you think I went to such lengths to get the OP to work that out for themself?

a) It's not a java problem they are having... It's a logic problem.
b) I think that your explanation was rather long and would only confuse them even more. Once someone can see an example in a simple program, they will understand how to use it in more complex applications.
It's not like I did their complete assignment. Gee!!

Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...

When I execute this progammatically, I get a table with row heights much larger than when I do this manually.

Note : Sel is the Word.Selection object and the Clipboard contains an Excel Table.

public void AddClipboard()
{
Sel.PasteExcelTable(false,false, false);
var t = Sel.Tables[Sel.Tables.Count];
t.AutoFitBehavior(Word.WdAutoFitBehavior.wdAutoFitContent);
}

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...