• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

About potential trips/traps in the SCJP exam in FAQ

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

I don´t undestand this points in the FAQ about potential trips/trap in SCJP exam. I would like see an example code about it, can you help me?.

1 - Forward references to variables gives a compiler error.
2- All comparisons involving NaN and a non-NaN always result in false.
3- You can never cast objects of sibling classes (sharing the same parent).

Thanks in advance
 
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Forward references to variables gives a compiler error




Even before b is initialized , a is trying to access it. ERROR. However forward reference id possible in somecase.


All comparisons involving NaN and a non-NaN always result in false.


NaN is defined in Double and Float as,
public static final float NaN = 0.0f / 0.0f; (Float class)
public static final double NaN = 0.0d / 0.0; (Double class)

Except != operator all other comparision results in false.

You can never cast objects of sibling classes (sharing the same parent).




Results in error because C & B does not share any relation directly.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic