• Tutorials
  • Courses
  • Tracks
Switch to Dark Mode

What is the correct way to declare an interface in Java?

Last Updated : Apr 1, 2025
Discuss
Comments

What is the correct way to declare an interface in Java?

A

interface MyInterface { void myMethod() {}; }


B

abstract interface MyInterface { void myMethod(); }


C

public interface MyInterface { void myMethod(); }

D

class MyInterface { void myMethod(); }

Share your thoughts in the comments