Concept of "interface" in Java
The interface keyword is used to create fully abstract classes. The main purpose of an interface is to determine how we can use the class that implements it. The interface creator defines method names, argument lists, and return types, but does not implement their behavior. All methods are implicitly declared as public.
Since Java 8, interfaces are allowed to host the implementation of default methods and static methods.
The interface can also contain fields. In this case, they are automatically public static final.
Read also:
- Where and what is the abstract modifier used for
- What are the access modifiers in Java
- What does the final keyword say
Comments
Post a Comment