1An abstract method is the method which does’nt have any body.
2Abstract method is declared with
3keyword abstract and semicolon in place of method body.
4
5 public abstract void <method name>();
6Ex : public abstract void getDetails();
7It is the responsibility of subclass to provide implementation to
8abstract method defined in abstract class
1abstract class Sum{
2
3 public abstract int compute(int a, int b);
4 public void disp(){
5 System.out.println("Method of class Sum");
6 }
7}
8class Demo extends Sum{
9
10 public int compute(int a, int b){
11 return a+b;
12 }
13 public static void main(String args[]){
14 Sum obj = new Demo();
15 System.out.println(obj.compute(3, 7));
16 obj.disp();
17 }
18}