Abstract class or methods example-3
This motive of this code is to show that an abstract class can hold abstract and non abstract classes
This motive of this code is to show that an abstract class can hold abstract and non abstract classes
abstract class BaseAbstractClass {
abstract void baseMethod1();
// Definition done in DerivedClass class
void baseMethod2() {
System.out
.println("baseMethod2() method called form BaseAbstractClass");
}
}
class DerivedClass extends BaseAbstractClass {
void baseMethod1() {
System.out
.println("Defining the defination of abstract method baseMethod1()");
}
}
class AbstractExample2 {
public static void main(String[] args) {
DerivedClass b = new DerivedClass();
b.baseMethod1();
b.baseMethod2();
}
}
/*
* Defining the definition of abstract method baseMethod1()
* baseMethod2() method called form BaseAbstractClass
*/
|