//MethodOverload1a.java
// One way to fix the error in the previous sample is to create an object of the class and use this object to invoke the methods from inside the main method.

public class MethodOverload1a{

public static void main( String args[])
{

MethodOverload1a obj = new MethodOverload1a();
System.out.print("The square of integer 7 is " + obj.square(7));
System.out.print("\nThe square of double 7.5 is " + obj.square(7.5));
}

public int square(int x)
{
return x * x;
}

public double square(double y)
{
return y * y;
}
}