Array Initialization !!!
Hi,
Which of these statements are legal. Select the three correct answers.
A. int arr[][] = new int[5][5];
B. int[]arr[] = new int[5][5];
C. int[] arr = new int[5][];
Correct Answer: A,B,C
C is right answer? How ? When I compiling the code compiler err
coming for incompatible type(C answer) !!
pls anyone can explain the reason.
[390 byte] By [
jaban_10a] at [2007-10-3 3:15:42]

Here's more to my codeing i got done today if ne one still knows what im talking about if ne one can help
public class NFL2 {
public static String [] [] AFC = {
{"Buffalo","Miami","New England","New York Jets"},
{"Cincinnati","Baltimore","Pittsburgh","Cleveland"},
{"Jacksonville","Houston","Tennesse","Indianapolis"},
{"Oakland","San Diego","Denver","Kansas City"}
};//string at class level
public static String [] [] NFC = {
{"New York Giants","Dallas","Philadelphia","Washington"},
{"Detroit","Green Bay","Chicago","Minnesota"},
{"Atlanta","New Orleans","Tampa Bay","Carolina"},
{"St. Louis","Arizona","San Francisco","Seattle"}
};//string at class level
public static int AFCwins[][] = new int [4][4];
public static int AFCloss[][] = new int [4][4];
public static int NFCwins[][] = new int [4][4];
public static int NFCloss[][] = new int [4][4];
public static void playGame (String team1,int i, int c, String team2, int i2, int c2, String conf){
int score1 = 2 + (int)(Math.random() * 60);
int score2 = 2 + (int)(Math.random() * 60);
System.out.println(team1 + "\t"+ score1);
System.out.println("VS");
System.out.println(team2 + "\t" + score2);
if (conf.equals("A") && score1 > score2){
System.out.println(team1 + " Wins");
AFCwins[i][c]=1;
AFCloss[i][++c]=1;
}else if (conf.equals("A") && score2 > score1){
System.out.println(team2 + " Wins");
AFCwins[i][++c]=1;
AFCloss[i][c]=1;
}else if (conf.equals("N") && score1 > score2){
System.out.println(team1 + " Wins");
NFCwins[i][c]=1;
NFCloss[i][++c]=1;
}else if (conf.equals("N") && score2 > score1){
System.out.println(team1 + " Wins");
NFCwins[i][++c]=1;
NFCloss[i][c]=1;
}else{
System.out.println("This should not come up ever!");
}
System.out.println();
}//end play game
public static void main(String[] args) {
for (int i = 0; i < AFC.length; i++) {
for (int c = 0; c < AFC[i].length; c++) {
String conf="A";
playGame (AFC[i][c],i,c,AFC[i][++c],i,c, conf);
}
System.out.println();
}
for (int i2 = 0; i2 < NFC.length; i2++) {
for (int c2 = 0; c2 < NFC[i2].length; c2++) {
String conf= "N";
playGame (NFC[i2][c2],i2,c2,NFC[i2][++c2],i2,c2, conf);
}
System.out.println();
}
}//end main method
}//end class