When I run the code, I get prompt to enter the number and I enter the number but nothing happens after that! I'm trying to implement method overloading here. Any help would be appreciated.
import java.util.Scanner;
public class MethodOverload {
public static void main(String [] args){
Scanner input = new Scanner(System.in);
Scanner inputDoub = new Scanner (System.in);
System.out.println ("Enter the int or double number");
int x = input.nextInt();
double y = inputDoub.nextDouble();
//int x;
//double y;
System.out.printf("Square of integer value %d", x, "is", square(x));
System.out.printf("Square of double value %f", y, "is", square(y));
}
public static int square(int intValue){
System.out.printf ("\nCalled square method with int argument: %d", intValue);
return intValue*intValue;
}
public static double square (double doubleValue){
System.out.printf ("\nCalled sqauer method with double argument: %d", doubleValue);
return doubleValue*doubleValue;
}
}