the expression

ages[i][j] = i * j;

is representing an assignment of the result i * j to the "location"
2,2 in the array.
If you draw the array, it would look like this




On Feb 12, 11:34 am, Michel <michelana...@gmail.com> wrote:
> Hello folks,
> Can someone please help me understand this part of the code from
> LAB-1036: Exercise 1, part 2?
>
> // Display the value of each entry in the array
>         for( int i=0; i<ages.length; i++ ){
>              System.out.println("\nStarting row " + i);
>             for( int j=0; j<ages[i].length; j++ ){
>                 ages[i][j] = i * j;
>                 System.out.print( ages[i][j] + " " );
>
> When we say ages[i][j] = i * j; does that mean that if for instance
> i=2 and j=2 then the array will display as number 4 (2*2=4)? I guess
> what I don't understand is how an array that is represented as rows
> and columns can equal a number (since i * j is a number)?

-- 
To post to this group, send email to javaprogrammingwithpassion@googlegroups.com
To unsubscribe from this group, send email to 
javaprogrammingwithpassion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to