Home Tutorial Java Scjp Part9 SCJP Module-9 Question-23

 
 

Share on Google+Share on Google+
SCJP Module-9 Question-23
Posted on: July 19, 2010 at 12:00 AM
Advertisement
The sample code given below will check your understanding about the sorting string of an ArrayList object.

Given below the sample code :

import java.util.*;
public class SortStrings{
public static void main(String[] args) {
ArrayList<String> str = new ArrayList<String>();
str.add("bBbB");
str.add("BbB");
str.add("bBb");
str.add("BBbb");
Collections.sort(str);
for (String a : str) { System.out.print(a + " "); }
}
}

What will be the output of the above code ?

 1. bBbB bBb BBbb BbB

2. BBbb Bbb bBb bBbB

3. BbB BBbb bBbB bBb

4. bBb BbB bBbB BBbb

Answer

(2)

Advertisement

Related Tags for SCJP Module-9 Question-23:


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 19, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com