What is the result?

Given:

What is the result?
A. 91 98
99 100 null null null
B. 91 98
99100 101 102 103
C. Compilation rails.
D. A NullPointerException is thrown at runtime.
E. An ArraylndexOutOfBoundsException is thrown at runtime.

Download Printable PDF. VALID exam to help you PASS.

3 thoughts on “What is the result?

  1. public static void main(String[] args) {
    String [] [] chs = new String[2][];
    chs[0] = new String[2];
    chs[1] = new String[5];

    int i = 97;//from this line we give the array element values
    for(int a =0; a<chs.length; a++){
    for(int b=0 ; b<chs.length;b++){
    chs[a][b] = "" +i;
    i++;
    }

    }
    for (String[] ca : chs){ //print every element
    for (String s :ca){
    System.out.print(s+" ");
    }
    System.out.println();
    }
    }

Leave a Reply

Your email address will not be published. Required fields are marked *