This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes explain the code output Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "explain the code output" Watch "explain the code output" New topic
Author

explain the code output

anita dhar
Ranch Hand

Joined: Jul 14, 2007
Posts: 69
import java.util.*;
class Flubber
{
public static void main(String[] args)
List<String> x = new ArrayList<String>();
x.add("x");
x.add("xx");
x.add("Xx");

// insert code here
for(String s: x)
System.out.println(s);

And output :
xx
Xx
x



which code inserted at // insert code here . will produce the preeceding output ?
(choose all that apply)

A . Collection.sort(x);

B . Comparable c = Collection.reverse();
Collections.sort(x,c);
C . Comparator c = Collection.reverse();
Collections.sort(x,c);
D . Comparable c = Collection.reverseOrder();
Collections.sort(x,c);
E. Comparator c = Collection.reverseOrder();
Collections.sort(x,c);
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35240
    
    7
That's rather easy to find out, isn't it?

Also, please QuoteYourSources.


Android appsImageJ pluginsJava web charts
anita dhar
Ranch Hand

Joined: Jul 14, 2007
Posts: 69
i am not getting the flow order of this question
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: explain the code output
 
Similar Threads
collections
Whats the output???
Collections.sort
doubt about the program???
comparable and comparator interface