0
What is interface in Java ? What is the use of it ?
explain Java interface with simple example
1 Odpowiedź
+ 3
It is collection of method declaration. the methods does not contain body here.It has only declaration. the body is implemented in a class which implements the interface(using 'implements' keyword).
So remember ,methods declared in interface cannot be overridden.
While the variables declared in the interface are final variables i.e these variables cannot be modified again anywhere in the program.