/* Multi-method example */ package mm; public class c5 extends c4{ public int m(String s){ return 2;} public static void main(String args[]){ c4 o1 = new c4(); c5 o2 = new c5(); c4 o3 = new c5(); String a1 = new String("Hi"); Object a2 = new Object(); Object a3 = new String("Hello"); System.out.println(o1.m(a1)); System.out.println(o1.m(a2)); System.out.println(o1.m(a3)); System.out.println(o2.m(a1)); System.out.println(o2.m(a2)); System.out.println(o2.m(a3)); //returns 1 since method resolution is done statically System.out.println(o3.m(a1)); //returns 1 since method resolution is done statically System.out.println(o3.m(a2)); System.out.println(o3.m(a3)); //returns 1 since method resolution is done statically } }