Hello everyone,
I got a problem with program that should take arguments and use them, but it's not using them.
Code:
class Hr10NewRoot { public static void main(String[] args) { //Hour ten, example one. int number = 100; if (args.length > 0) { number = Integer.parseInt(args[0]); } System.out.println("The square root of " + number + " is " + Math.sqrt(number) ); } }
Output:
run:
The square root of 100 is 10.0
BUILD SUCCESSFUL (total time: 0 seconds)
Argument: 169
Expected output: The square root of 169 is 13.0
IDE: Netbeans(If it helps in anyway)
This code is from a book, all steps where followed so it should work well.