Here's how my program works. 

I start by creating my program: 

-bash-4.1$ pico -w Four.java

I compile my program: 

-bash-4.1$ javac Four.java

I then run it: 

-bash-4.1$ java Four
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
        at Four.main(Four.java:3)

I need to provide my input (a number) on the command line. 

-bash-4.1$ java Four 2
1.414213562372879 squared is equal to 2.0

I calculate square root of 2 with 12 decimals precision. 

-bash-4.1$ java Four 2
1.414213562372879 squared is equal to 2.0

I try another number: 

-bash-4.1$ java Four 3
1.7320508075689531 squared is equal to 3.0

If I provide a String instead of a number the program cannot handle it: 

-bash-4.1$ java Four what
Exception in thread "main" java.lang.NumberFormatException: For input string: "what"
        at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1241)
        at java.lang.Double.parseDouble(Double.java:540)
        at Four.main(Four.java:3)

If I type a number with decimals my program works perfectly: 

-bash-4.1$ java Four 6.25
2.500000000000213 squared is equal to 6.25
-bash-4.1$

The little difference in accuracy can be easily explained by finite representation and limited precision. 

--