class Base { public void method(int i) { System.out.print("Value is " + i); } } public class MainClass extends Base { public void method(int j) { System.out.print("This value is " + j); } public void method(String s) { System.out.print("I was passed " + s); } public static void main(String args[]) { Base b1 = new Base(); Base b2 = new MainClass(); b1.method(5); b2.method(6); } }