Home Tutorial Java Scjp Part6 SCJP Module-6 Question-13

 
 

SCJP Module-6 Question-13
Posted on: July 14, 2010 at 12:00 AM
This program will check your understanding of Collection in Java and prepare you for SCJP exam.

Given below the sample code :

public static Collection fetch() {
Collection mylist = new LinkedList();
sorted.add("B"); sorted.add("C"); sorted.add("A");
return mylist;
}
public static void main(String[] args) {
for (Object o: fetch()) {
System.out.print(o + ", ");
}
}

What will be the output of the following code ?

1. Give compile error

2. A B C

3  B, C , A

4. B C A

Answer :

(3)

 

 

Related Tags for SCJP Module-6 Question-13: