FileDocCategorySizeDatePackage
SquareRoot.javaAPI DocExample377Sat Sep 29 23:50:34 BST 2001None

SquareRoot.java

// Finding the square root of a number
import java.io.*;

class SquareRoot {
  public static void main (String[] args) {
  // Let's do it with variables this time  
    double myNum = 2.0;
    double theRoot; // assign later
    theRoot = Math.sqrt(myNum);
    System.out.println("The square root of " + myNum + " is " + theRoot);
  } // end main
} // end SquareRoot