Home Tutorial Java Certification Abstract class or methods example-2

 
 

Abstract class or methods example-2
Posted on: June 30, 2010 at 12:00 AM
In this example you will see that an abstract class can extend another abstract class.
package roseindia1;

abstract class Lion {
  abstract void runLion()// defined in the non abstract class
}

abstract class Lion1 extends Lion {
  abstract void runLion1()// defined in the non abstract class
}

class BuzzwordLion extends Lion1 {
  void runLion() {
    System.out
    .println(" Defining the defination of abstract method runLion()");
  }

  void runLion1() {
    System.out
    .println(" Defining the defination of abstract method runLion1()");
  }

}

class AbstractExample1 {
  public static void main(String[] args) {
    BuzzwordLion b = new BuzzwordLion();
    b.runLion();
    b.runLion1();
  }
}

/*
 * --------------------Output-------------------- 
 *  Defining the defination of abstract method runLion()
 *  Defining the defination of abstract method runLion1()
 */

Related Tags for Abstract class or methods example-2:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.