//MethodOverload1b.java
// One way to fix the error in the original sample is declare the methods as static.
public class MethodOverload1b{
public static void main( String args[])
{
System.out.print("The square of integer 7 is " + square(7));
System.out.print("\nThe square of double 7.5 is " + square(7.5));
}
public static int square(int x)
{
return x * x;
}
public static double square(double y)
{
return y * y;
}
}