Advertisement
Arnab_Manna

abstraction1.java

Nov 27th, 2021
869
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. abstract class Shape{
  2.     abstract void draw();
  3. }
  4.  
  5. class Rectangle extends Shape{
  6.     void draw(){System.out.println("drawing rectangle");}
  7. }
  8.  
  9. class Circle1 extends Shape{
  10.      void draw(){System.out.println("drawing circle");
  11.      }
  12. }
  13.  
  14. abstract class TestAbstraction1{
  15.     public static void main(String args[]){
  16.         Shape s=new Circle1();
  17.         s.draw();
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement