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
(2)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.