Interface vs abstract class in java - Java @ Desk

Monday, May 20, 2013

Interface vs abstract class in java

1) Interface contains only method declarations whereas abstract class contains method declarations that are abstract methods plus the non abstract methods that have definitions also

2) By default methods in an interface are abstract whereas abstract class contains non abstract methods also.

3) An abstract class can extend only one class where an interface can extend multiple interfaces.

4) Variables declared in interface are by default public static final whereas abstract class variable not necessarily public static final






No comments:

Post a Comment