0

What is interface in Java ? What is the use of it ?

explain Java interface with simple example

28th Aug 2017, 3:06 PM
Sreejith P
Sreejith P - avatar
1 Answer
+ 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.
28th Aug 2017, 7:53 PM
shadab gada