DEV Community

Er. Bhupendra
Er. Bhupendra

Posted on

JAVA INTERVIEW QUESTION REVISION

1 DIFF B/W INTERFACE AND ABSTRACT

Feature Interface Abstract Class
Purpose Defines a contract Provides partial abstraction + implementation
Methods Mostly abstract methods (Java 8+: default & static allowed) Can have abstract + concrete methods
Variables Only public static final (constants) Can have instance variables
Constructor ❌ Not allowed ✅ Allowed
Inheritance Class can implement multiple interfaces Class can extend only one abstract class
Access Modifiers Methods are public by default Methods can have any access modifier
Keyword used implements extends

2.

Top comments (0)