Emon766

abstract

Sep 27th, 2021
926
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. package javaapplication15;
  3.  
  4.  abstract class A
  5.  {
  6.     public A() {
  7.         System.out.println("This is constructor of abstract class");
  8.     }
  9.  
  10.    abstract void  a_method();
  11.  
  12.     public void non_method()
  13.     {
  14.         System.out.println("This is a normal method of abstract class");
  15.     }
  16. }
  17.  
  18.  class B extends A{
  19.  
  20.      @Override
  21.      void a_method() {
  22.          System.out.println("This is abstract method");
  23.      }
  24.  
  25.      public static void main(String[] args) {
  26.          A q = new B();
  27.          q.a_method();
  28.          q.non_method();
  29.      }
  30.  
  31.  }
RAW Paste Data