programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Tim Cooke
• Campbell Ritchie
• Paul Clapham
• Ron McLeod
• Liutauras Vilda
Sheriffs:
• Jeanne Boyarsky
• Rob Spoor
• Bear Bibeault
Saloon Keepers:
• Jesse Silverman
• Tim Moores
• Stephan van Hulst
• Tim Holloway
• Carey Brown
Bartenders:
• Piet Souris
• Al Hobbs
• salvin francis

# another question form Poddar's questions

Greenhorn
Posts: 25
• Number of slices to send:
Optional 'thank-you' note:
Q 29. What is the output
{
Float f1 = new Float("4.4e99f");
Float f2 = new Float("-4.4e99f");
Double d1 = new Double("4.4e99");
System.out.println(f1);
System.out.println(f2);
System.out.println(d1);
}
a) Runtime error
b) Infinity
-Infinity
4.4E99
c) Infinity
-Infinity
Infinity
d) 4.4E99
-4.4E99
4.4E99
Can anybody tell me how to compute it?
Thanks

Ranch Hand
Posts: 149
• Number of slices to send:
Optional 'thank-you' note:
Can you tell the me the poddar's url, if it is not paid mock exam.

Ray Chang
Greenhorn
Posts: 25
• Number of slices to send:
Optional 'thank-you' note:
the url is
you can also find it in javaranch mock exam list.

Ranch Hand
Posts: 2120
• Number of slices to send:
Optional 'thank-you' note:
b is correct. You shouldn't know by heart the exact value of Float.MAX_VALUE or Float.MIN_Value but the range for the exponent in base 10 for a float is easy to remember : -38 to 38
Also for a double: -308 to 308

Ranch Hand
Posts: 49
• Number of slices to send:
Optional 'thank-you' note:
Float.MAX_VALUE==3.4028234663852886E38f
Float.MIN_VALUE==1.401298464324817E-45f
Double.MAX_VALUE==1.7976931348623157E308d
Double.MIN_VALUE==4.9E-324d

Ranch Hand
Posts: 1056
• Number of slices to send:
Optional 'thank-you' note:
The range for normalized floats is -38 to 38, and for normalized doubles -308 to 308. But Java floating-point representations apparently allow "denormals" as well, which accounts for the MIN_VALUEs given above.

Ranch Hand
Posts: 787
• Number of slices to send:
Optional 'thank-you' note:
What is a Normal or Denormal Float?