• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About potential trips/traps in the SCJP exam in FAQ

 
Yeray Santana Borges
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • 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
 
James Tharakan
Ranch Hand
Posts: 580
Eclipse IDE
  • Mark post as helpful
  • send pies
  • 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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic