File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Float blues Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Float blues" Watch "Float blues" New topic

Float blues

bobby chaurasia
Ranch Hand

Joined: Mar 30, 2002
Posts: 84
One of Dans test ( Chapter 10, exam2, Q no 5)
reads as
public static void main( String args[]){
Float f = new Float("1.0");
Float f1 = new Float("1.0f");
Float f2 = new Float("Infinity");
Float f3 = new Float("-Infinity");
Float f4 = new Float("NaN");
When I tried to compile, it gave me NumberFormatException.
The answer given is that it should compile and run okay.
Any clues why its not compiling ?
bobby chaurasia
Ranch Hand

Joined: Mar 30, 2002
Posts: 84
A minor correction, it compiled okay but on running it gave this error.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Funny, on 1.4.1_01 it compiles and runs OK.

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
It is sorta covered in the JavaRanch Style Guide.
subject: Float blues