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

 
 

Share on Google+Share on Google+
SCJP Module-6 Question-13
Posted on: July 14, 2010 at 12:00 AM
Advertisement
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)

 

 

Advertisement

Related Tags for SCJP Module-6 Question-13:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 14, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com