Take the 2-minute tour ×

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?

share|improve this question
Who gave you that value and asked you to try it? :-) –  Ray Toal Nov 1 '11 at 4:09
javac 1.6.0_12 compiles it OK -- the compiler doesn't hang. But java version "1.6.0_12" does indeed appear to hang (in a CPU loop) trying to execute the line. –  Hot Licks Nov 1 '11 at 4:12
When one day I was surfing on the internet, I suddenly came across a tutorial in which this was mentioned but the actual reason I was unable to find in that tutorial. –  Bhavesh Nov 1 '11 at 4:13
(As to the reason for this, it proves that even the JDK developers are mortal.) –  Hot Licks Nov 1 '11 at 4:20
add comment

1 Answer

up vote 10 down vote accepted

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)

share|improve this answer
+1: Many parsers have run into this bug, even google docs once had a problem with this. –  Peter Lawrey Nov 1 '11 at 8:21
add comment

Your Answer


