Home » JAVA Programming » Arrays » Question
  1. What is the type of variable ‘b’ and ‘d’ in the below snippet?

    int a[], b;
    int []c, d;
    1. ‘b’ and ‘d’ are int
    2. ‘b’ is int variable; ‘d’ is int array
    3. ‘d’ is int variable; ‘b’ is int array
    4. ‘b’ and ‘d’ are arrays of type int
    5. None of these
Correct Option: B

If [] is declared after variable it is applicable only to one variable. If [] is declared before variable it is applicable to all the variables.



Your comments will be displayed only after manual approval.