Bapa

Untitled

Mar 17th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. class Parent
  2. {
  3.   private void method1()
  4.                 {
  5.                    System.out.println("Parent's method1()");
  6.     }
  7.  
  8.   public void method2()
  9.                  {
  10.                  System.out.println("Parent's method2()");
  11.   method1();
  12.                  }
  13.  
  14. }
  15.  
  16. class Child extends Parent
  17. {
  18.   public void method1()
  19.   {
  20.   System.out.println("Child's method1()");
  21.                  }
  22.  
  23.   public static void main(String args[])
  24.   {
  25.   Parent p = new Child();
  26.                                 p.method2();
  27.   }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment