| class mother {
 public String home() { String x = "old"; return x;}
 }
 // ==================
 class child extends mother {
 public String home() { String x = "new"; return x;}
 }
 // ==================
 class work{
 public static void main (String args[]) {
 mother x = new child();
 System.out.print(x.home()); // new
 }
 }
 // Dynamic Binding of method is polymorphism
 // if home is static will use home() in mother
 // compile will check in mother
 // run will check in child so output is new
 // no problem is not override in child
 // study from ajarn Passakorn Pruekpitakkul
 
 
 |