Advertisement
brandblox

java lab 0.5 (16/10/2023)

Oct 16th, 2023
756
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. abstract  class abc
  2. {
  3.     abstract void callme();
  4.     void callmethod()
  5.     {
  6.         System.out.println("I am in callmethod");
  7.     }
  8. }
  9. class xyz extends abc
  10. {
  11.     void callme()
  12.     {
  13.         System.out.println("I am in callme()");
  14.     }
  15. }
  16.  
  17. public class Demo
  18. {
  19.     public static void main(String[] args)
  20.     {
  21.         abc ob;
  22.         xyz obj=new xyz();
  23.         obj.callmethod();
  24.         obj.callme();
  25.         ob=obj;
  26.         ob.callmethod();
  27.         ob.callme();
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement