Can we have static methods in 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 Princeton University, Lives in Princeton, NJ
In Java 8, interfaces can contain implemented methods, static methods, and the so-called "default" methods (which the implementing classes do not need to override). ... "default" methods shouldn't have been allowed in interfaces at all. You could always use an abstract class for this purpose.Mar 21, 2014
2023-06-09 06:42:34
评论(499)
Helpful(122)
Helpful
Helpful(2)

Ava Richardson
QuesHub.com delivers expert answers and knowledge to you.
In Java 8, interfaces can contain implemented methods, static methods, and the so-called "default" methods (which the implementing classes do not need to override). ... "default" methods shouldn't have been allowed in interfaces at all. You could always use an abstract class for this purpose.Mar 21, 2014