Hi,
26) A sample question provided by Sun
Which correctly create an array of five empty Strings?
A.String a [] = new
String [5];
for (int i = 0; i < 5; a[i++] = "");
B.String a [] = {"", "", "", "", ""};
C.String a [5];
D.String [5] a;
E.String [] a = new String [5];
for (int i = 0; i < 5; a[i++] = null);
According to me the ans is only b but it is given both a and b.
in optA for (int i=0; i<5; a[i++]="") means it is omitting the zeroth element and thus returns only 4 elements?
Can anybody explain???
Thank you.