This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Float blues" Watch "Float blues" New topic
Author

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 ?
Thanks...
bobby chaurasia
Ranch Hand

Joined: Mar 30, 2002
Posts: 84
A minor correction, it compiled okay but on running it gave this error.
Thanks
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
 
Similar Threads
Doubt with Float class
Float
another question form Poddar's questions
Dan's question
Wrapper class