Uma de array

Given the following:


public class Teste {
    public static void main(String args []) {
         int [] [] [] x = new int [3] [] [];
         int i,j;
         x[0] = new int [4] [];
         x[1] = new int [2] [];
         x[2] = new int [5] [];
         for ( i = 0; i < x.length; i++ )  
               for ( j = 0 ; j<x[i].length; j++ ) {
                      x[i][j] = new int [ i + j + 1];
                      System.out.println("size =" + x[i][j].length);
               }
        }
 }  

how many lines of output will be produced?

A. 7
B. 9
C. 11
D. 13
E. Compilation fails
F. An exception is thrown at runtime

A resposta é

C. 11

Porque:
x[0] é um array de 4 posições
x[1] é um array de 2 posições
x[2] é um array de 5 posições

4 + 2 + 5 = 11

Acho q é a letra C: 11

letra C, ótima questão!

Essa foi interessante. Realmente a resposta é C.

É a letra C !
Uma questão bem legal … :wink:

Estão todos certos, a resposta correta é a C. :smiley: