Tuesday, 2 April 2013

Array - 11

What is the result of attempting to compile and run the following class?


package net.dharmaraj;

class Ar {
public static void main(String[] args) {
int[] seeds = new int[3];
for (int i = 0; i < seeds.length; i++)
System.out.println(i);
}
}



Select all valid answers. 
a) 0 
b) 1 
c) 2 
d) 3 
e) the program does not compile because the seeds array is not initialized 

Ans: a, b, c

Output:

0
1
2


No comments:

Post a Comment