I have tried the following code in NetBeans 6.9.1, it should display the value on the console but the compiler surprisingly hangs up. The code snippet is as follows.
package demo;
public class Main
{
public static void main(String[] args)
{
System.out.println("Test Demo:");
double d = Double.parseDouble("2.2250738585072012e-308");
//double d = Double.parseDouble("30000.2250738585072012e-308"); Works with no hangs up.
System.out.println("Value = " + d);
}
}
It may not be the case of the range of double in Java. If the specified value is out of the range, it should throw some exception or result in some error but it hangs up, instead. What should actually be the reason?
This is a known java compiler bug, the solution is to update to the latest JDK (a patch was released for existing JDKs prior to JDK 6u24, and this fix was included in Sun/Oracle JDK 6u24).
(edit: added note about which version fixed this issue)