what is Interface ?
In Java, an interface is a blueprint of a class that defines a set of abstract
methods (methods without a body) that a class must implement. Interfaces help
achieve abstraction and multiple inheritance in Java.
key points:-
✅ interface methods are by default public and abstract.
✅ interface variables are by default public, static & final.
✅ interface methods must be overriden inside the implementing class. (if abstract)
✅ Defines abstract methods (method signatures without a body).
✅ Achieves abstraction (hides implementation details).
✅ Supports multiple inheritance (unlike classes, Java allows a class to implement
multiple interfaces).
✅ Cannot have instance variables, but can have static and final constants.
✅ Can have default and static methods with a body (Java 8+).
🔹 Default methods allow adding new methods without breaking existing code.
🔹 Static methods belong to the interface and cannot be overridden.