-3
public class NewRoot {
    public static void main(String[] arguments){
        int number = arguments[0];
        System.out.println("The square root of"
                + number
                + " is "
                + Math.sqrt(number)
            );
}
}

eclipse shows an error saying

Type mismatch: cannot convert from String to int

even though I put 225 on an argument. What's wrong with my code?

Kim
  • 79
  • 1
  • 1
  • 4

1 Answers1

0

To convert String to integer,

int number = Integer.parseInt(arguments[0]);
Wundwin Born
  • 3,467
  • 19
  • 37