Sunday 23 October 2016

abstract method

abstract mtehod

abstract method
  • abstract class and Interface can contains abstract method.
  • abstract method will not have method body.
  • abstract method will be implemented in sub class of abstract class.
  • abstract method ends with semicolon.
                         abstract returntype methodName(parameters);
                         abstract void withDraw(int a);
  • Example basic structure to understand.
            abstract class Demo1
                    public void method1()
                          System.out.println("this is method1 which is implemented")
                    public abstract void method2();

Thanks for your time.