Thursday 4 September 2014

Can we define abstract class without abstract methods in Java

Yes, You can do that.

Example1
public abstract class AbstractEx {

}

Example2
public abstract class AbstractEx {
    int sum(int a, int b){
        return a+b;
    }
}

Above two programs compile and runs fine.



                                                             Home

No comments:

Post a Comment