//Sqrt.java import javax.swing.*; public class Sqrt extends JApplet { public void init() { String input; double num; double numSqrt; input = JOptionPane.showInputDialog( "Enter a number" ); num = Double.parseDouble( input ); //***sqrt method takes one double parameter (an int will be converted to double) //***Returns a double, so cannot assign to an int. numSqrt = Math.sqrt(num); JOptionPane.showMessageDialog(null, "Square root = " + numSqrt ); //this is syntax error: //int answer = Math.sqrt(num); } } /* Try negative parameter 2*num as parameter no need of numSqrt */