This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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
Sheriff
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!