-8

Which of the following are valid and what is the size of a and b? I am using java language?

1. int[ ]   a, b;
2. int[ ]   a[ ], b;
3. int[ ]   a[ ], b[ ];
4. int[ ]   [ ]a, b;
5. int[ ]   [ ]a, b[ ];
6. int[ ]   [ ]a, [ ]b;

what is the dimension of a and b. how can i find its dimensions. and what is wrong with the last declaration.

1 Answers1

0

first you have typo instead of Int it should be int.

Answer :- if we want specify dimension before the variable, that facility is applicable only for first variable in a declaration. If we are trying to apply for remaining variables, we will get compile time error.

1. a=1, b=1;
2. a=2, b=1;
3. a=2, b=2;
4. a=2, b=2;
5. a=2, b=3;
6. Compile time error.