Sunday 23 October 2016

abstract basics

abstract basics

abstract is a keyword, we can apply on 
  1. class
  2. method
Method 
  • Java method have two parts,
    • First one is method name and parameters(if exists)
    • Second is method body.
Example 
                         public void method1(int a, int b)
                         {
                                This is body of the method;
                         }
Implemented method
  • A method which has method name and method body is called implemented method.
  • We can say these methods as non abstract methods.
Example 
                         public void sum(int a, int b)
                         {
                                This is body of the method;
                         }
Unimplemented method
  • A method which has only method name and no method body is called unimplemented method.
  • We can say these methods as abstract methods.
Example 
                         public abstract void withDraw(int money);

Thanks for your time.
Nireekshan