• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Float blues

 
bobby chaurasia
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A minor correction, it compiled okay but on running it gave this error.
Thanks
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Funny, on 1.4.1_01 it compiles and runs OK.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic