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: