Hi Guys,
I am preparing for the
SCJP exam. I have a doubt, please clarify it for me.
public class Java_arrays {
public static void main(
String[] args){
byte[][] big=new byte[7][7];
byte[][] b=new byte[2][1];
byte b3=45;
byte b2[][][][]=new byte[2][3][1][2];
}
}
Which of the code should be inserted after the code to compile correctly?
1) If I insert the code b2[0][1]=b; // it works and I got it.
2) If I insert the code b2[1][1][0]=b[0][0];
//because two-dimensional array cannot fit in three dimensional specifications (I understood like this)
3) If I insert the code b2[0][1][0][0]=b[0][0]; //compiler accepts it.
4) If I insert the code b2[1][2][0][1]=b; //Compiler won�t accept this
I don�t get this 3 and 4.Can anyone please help me clarify this.I am looking for the rules here,please.
Thanks.