Array question

admin

Administrator
Staff member
I'm sure this is a really stupid question, but I've been looking for ages and I can't find it in my book. I'm working on an array for my intro to programming class, and I'm having some trouble getting it to work right...I know absolutely nothing about java. :)

Here's what I have so far (I'm using the JCreator compiler, if that makes a difference?):

import java.io.*;
import java.util.*;

class HomeworkB
{
public static void main(String[] args)
{
int a [][] = new int [11][11];

for(int row = 0; row<a.length; row ++)
{
for(int col = 0; col<a[row].length; col++)
a[row][col] = row * col;
}

for(int row = 0; row<a.length; row ++)
{
for(int col = 0; col<a[row].length; col++)
System.out.print(a[row][col] + " ");
System.out.println();
}

System.out.println();
System.exit(0);
}
}
 
Back
Top