wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Float argument 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 argument" Watch "Float argument" New topic
Author

Float argument

Barkat Mardhani
Ranch Hand

Joined: Aug 05, 2002
Posts: 787

Why line 1 gives error (too big of a float) while line 2 and 3 do not....
Greg Neef
Ranch Hand

Joined: Jun 16, 2003
Posts: 82
Float MAX_VALUE = 3.4028235E38 so the number you are entering is considered INFINITY even when it takes in the other two forms. I agree that it seems odd that it will take it as a string but not as a number.


SCJP 1.4
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Don't you think that asking the compiler to convert Strings into floats in order to check to see if it is too big a float might be a little too much to ask?
The last one is not too big because it isn't a float but rather a double. Moving a very large double to a float just turns the float into INFINITY.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Float argument
 
Similar Threads
Question on GC
Doubt in try - catch - finally block
Array Confsion
Another Exercise regarding Garbage Collection:
wrappers