• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Another error in SCJP5 quiz by muppeteer?  RSS feed

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

there is a question in the quiz:



and possible answers:

a) ab666
b) ab
c) doesn't compile

right answer given: c.

But the code compiles (with warnings but still compile!!!). It just throws an exception at runtime because String and Integer are not mutually comparable.

And another case. There is a piece of code without a question and you have to choose 1, 2, 3, 4:




regards

Serg
 
Java Cowboy
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a link to where we can find that test? Try sending a message to the author of the test.
 
Serg Masow
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The questions above are from a SCJP5 quiz included in Java.Inquisition, which can be found here:
http://enigma.vm.bytemark.co.uk/webstart.html
 
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can contact Matt Russel. He manages the mock exams on his application
 
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.util.Set;
import java.util.TreeSet;
public class Testing123
{
public static void main(String... args)
{
Set t = new TreeSet();
t.add("a");
t.add("b");
t.add("666");
for(Object o:t)
System.out.print(o);
}
}

output : 666ab

Can any one expalin me why its showing as 666ab, it should show ab666.
 
Serg Masow
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

because in this example TreeSet uses the natural order for sorting of it's elements and digits are "lesser" as letters.

regards
Serg
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!