File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes quiz on Float.parseFloat(String) 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 "quiz on Float.parseFloat(String)" Watch "quiz on Float.parseFloat(String)" New topic
Author

quiz on Float.parseFloat(String)

Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
A quiz on valid values for Float.parseFloat(String)(String)
Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
Answers:
// f = Float.parseFloat(s); //java.lang.NullPointerException
// f = Float.parseFloat(s); //java.lang.NumberFormatException: empty String
2.0
s= 4.9E-324
0.0
s= -4.9E-324
-0.0
s= 1.7976931348623157E308
Infinity
s= -1.7976931348623157E308
-Infinity
2.0
0.0020
2.0
// f = Float.parseFloat(s); //java.lang.NumberFormatException: For input string: "NAN"
// f = Float.parseFloat(s); //java.lang.NumberFormatException: For input string: "infinity"
NaN
-Infinity
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: quiz on Float.parseFloat(String)