Home Tutorial Java Certification Abstract class or methods example-2

 
 

Share on Google+Share on Google+
Abstract class or methods example-2
Posted on: June 30, 2010 at 12:00 AM
Advertisement
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()
 */
Advertisement

Related Tags for Abstract class or methods example-2:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 30, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com