مجلة الابحاث
تاريخ الإضافة : 29-10-2023
An Interface in Java programming language is defined as an abstract type used to specify the behavior of a class. An interface in Java is a blueprint of a behaviour. A Java interface contains static constants and abstract methods.
The interface in Java is a mechanism to achieve abstraction. In other words, you can say that interfaces can have abstract methods and variables. It cannot have a method body. Java Interface also represents the IS-A relationship.
When we decide a type of entity by its behaviour and not via attribute we should define it as an interface