• 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
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

enthuware error?

 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Q.No 23 of Test6 in enthuware, (its a DnD so, I couldn't copy and paste it here..)

gives an explanation like this regarding the natural ordering for strings:

3. Collections.sort(collection) method sorts the elements of the given collection in the natural order of it elements. Natural order means: as governed by the compareTo() method of the elements. I case of String elements, the natural order is: space < lower case < upper case. Here, the output is expected to be in reverse order, therefore, we need a reverse order Comparator. Collections.reverseOrder() returns such a comparator.



and the answer for the question too was based on this..

But isn't it:
space < upper case < lower case ?

Thanks,
Vishwa.
[ January 20, 2008: Message edited by: Vishwanath Murthi ]
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy Vishwa,

you are right.

prints
[ , A, a]


Yours,
Bu.
 
Burkhard Hassel
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...
But you are not right in calling it "errata".
Know why?
 
Vishwanath Krishnamurthi
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh! Its an "error"
 
Enthuware Software Support
Posts: 4907
60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vishwanath,
Thanks for pointing it out. The order is indeed space < upper case < lower case, but the given answer is correct and will remain same (in this particular situation).
 
Vishwanath Krishnamurthi
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

The question says,

Complete the Code so that it will print [amy, Adam, audrey] when run.


and (the completed code, the answer given)...



gives an O/P: [audrey, amy, Adam] (as expected) and not [amy, Adam, audrey]...
[ January 20, 2008: Message edited by: Vishwanath Murthi ]
 
Paul Anilprem
Enthuware Software Support
Posts: 4907
60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vishwanath,
That's because you aren't using the same code as given in the question. What you have written is but the code in question is
HTH,
Paul.
 
Vishwanath Krishnamurthi
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks..
 
reply
    Bookmark Topic Watch Topic
  • New Topic