0

Java interface.

Why's keywords like private and public is not use in interface method definition in java but those keywords is use in the class when implementing it.

20th Jan 2021, 8:18 PM
Sunday Othniel
Sunday Othniel - avatar
2 Antworten
+ 1
Methods inside an interface in Java are implicitly public so you need not specify that. Java 8 has introduced static and default methods as well. You cannot have a private or protected method inside an interface because then you will not be able to give implementation to it.
20th Jan 2021, 8:54 PM
Avinesh
Avinesh - avatar
0
Avinesh thanks for your explanation
21st Jan 2021, 1:32 PM
Sunday Othniel
Sunday Othniel - avatar