Share on Google+Share on Google+

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
abstract class BaseAbstractClass {
  abstract void baseMethod1()
  // Definition done in DerivedClass class

  void baseMethod2() {
    .println("baseMethod2() method called form BaseAbstractClass");

class DerivedClass extends BaseAbstractClass {
  void baseMethod1() {
  .println("Defining the defination of abstract method baseMethod1()");

class AbstractExample2 {
  public static void main(String[] args) {
    DerivedClass b = new DerivedClass();

 * Defining the definition of abstract method baseMethod1()
 * baseMethod2() method called form BaseAbstractClass


Posted on: July 1, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial 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.