• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Different results on JDK 1.2 and 1.3??

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
The following method will compile and run without any problems.
True/False?
public void switchTest(byte x)
{
switch(x)
{
case 'b': // 1
default : // 2
case -2: // 3
case 80: // 4
}
}
The above code compiles and runs fine in JDK1.3 but does not compile on JDK1.2 I understand the exam is based on JDK1.2 so should we answer True or False for such questions?
Thanks
Amol
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whatever the JLS says is the correct answer.
------------------
Tom - SCJP --- Co-Moderator of the Programmer Certification Forums
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just compiled it under both 1.2 and 1.3 w/o problem. What compiler error did you get?
Bill
 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here's a link to a few more 1.2/1.3 differences... hope this helps!!!

------------------
aka pinboxx
[This message has been edited by Paul Michael Laborte (edited July 18, 2001).]
 
Amol Keskar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Actually the question was from JQ+ where they have mentioned in their answer/reasoning that code does not compile on JDK1.2 but compiles on JDK1.3
Thanks,
Amol
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic