I would like to define a method in JAVA interface. The reason is that every time I implement interface the method is the same, but I need to implement two interfaces for particular classes. Example:
interface A
method A()
interface B
method B()
class first implements A,B
class second implements A
method A() has same body everywhere.
defaultkeyword. You can't do it in earlier versions. docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.htmlabstractclass in instead ofinterface AAthat needs implementations, you can get away in java <8 by making it an abstract class and keepingBan interface