0% found this document useful (0 votes)
13 views1 page

Interface

In Java, an interface is a blueprint that defines a set of abstract methods that must be implemented by a class, promoting abstraction and multiple inheritance. Interface methods are public and abstract by default, while variables are public, static, and final. Java 8 introduced default and static methods in interfaces, allowing for new methods without breaking existing code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

Interface

In Java, an interface is a blueprint that defines a set of abstract methods that must be implemented by a class, promoting abstraction and multiple inheritance. Interface methods are public and abstract by default, while variables are public, static, and final. Java 8 introduced default and static methods in interfaces, allowing for new methods without breaking existing code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

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.

You might also like