Computer Science, asked by amitabhdas1846, 11 months ago

Which of the following is a correct interface?
A.interface A { void print() { } }
B.abstract interface A { print(); }
C.abstract interface A { abstract void print(); { }}
D.interface A { void print(); }

Answers

Answered by Anonymous
1
ⓗⓔⓨ ⓕⓡⓘⓔⓝⓓ


⊙ It's option c

Hope it helps you
Answered by adventureisland
0

Option (D) is correct

In Java, an interface is a blueprint for a class. It features abstract methods and static constants.

About Interface syntax :

  • In Java, an interface is a blueprint for a class. It features abstract methods and static constants.
  • In Java, the interface is a means of achieving abstraction.
  • The Java interface can only have abstract methods, no method bodies. In Java, it is used to achieve abstraction as well as multiple inheritances.
  • To put it another way, interfaces can include abstract methods and variables. It is not allowed to have a method body.

Similar questions