• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

explain the code output

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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);
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's rather easy to find out, isn't it?

Also, please QuoteYourSources.
 
anita dhar
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am not getting the flow order of this question
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic