Is it right? An interface may contain abstract method. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it right? An interface may contain abstract method.

The fact is Interface only contains abstract methods and constants. So, I think: this statement: "An interface MAY contain abstract methods" is TRUE.

6th Nov 2022, 9:28 AM
Oliver Pasaribu
Oliver Pasaribu - avatar
2 Answers
+ 3
https://docs.oracle.com/javase/tutorial/java/IandI/interfaceDef.html "The interface body can contain abstract methods, default methods, and static methods. An abstract method within an interface is followed by a semicolon, but no braces (an abstract method does not contain an implementation)." I think it's a play on words, we don't have to use the abstract keyword to mark an interface method as abstract. If it has no implementation, it is implicitly abstract.
7th Nov 2022, 4:20 AM
Tibor Santa
Tibor Santa - avatar
0
Yes you can say that it's true
6th Nov 2022, 9:43 AM
I am offline
I am offline - avatar