Can you have private methods in an interface?
I'll answer
Earn 20 gold coins for an accepted answer.20
Earn 20 gold coins for an accepted answer.
40more
40more
Studied at Stanford University, Lives in Palo Alto. Currently working as a product manager for a tech company.
According to the Java programming language scope of the private members is limited to the class in which it is declared and can be accessed only by methods of that class . But inteface doesn't have a method body hence there is no use of declaring private members inside an interface .Apr 16, 2012
2023-06-17 06:34:35
评论(499)
Helpful(122)
Helpful
Helpful(2)

Benjamin Brown
QuesHub.com delivers expert answers and knowledge to you.
According to the Java programming language scope of the private members is limited to the class in which it is declared and can be accessed only by methods of that class . But inteface doesn't have a method body hence there is no use of declaring private members inside an interface .Apr 16, 2012