001package subclass.overload; 002 003class A { 004 public void m(String s) { System.out.println("A"); } 005} 006class B extends A { 007 public void m(Object o) { System.out.println("B"); } 008} 009 010class Main { 011 private Main() {} 012 public static void main(String[] args) { 013 String y = "?"; 014 Object x = y; 015 B b = new B(); 016 A a = b; 017 a.m(y); 018 // a.m(x); 019 b.m(y); 020 b.m(x); 021 } 022}