Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Java by (3.9k points)

Consider an example (which compiles in java)

public abstract interface Interface {

    public void interfacing();

    public abstract boolean interfacing(boolean really);

}

Why is it necessary for an interface to be "declared" abstract? Is there other rules that applies with an abstract interface?

1 Answer

0 votes
by (46k points)

It is not necessary to declare the interface abstract.

Just like declaring all those methods public (which they already are if the interface is public) or abstract (which they already are in an interface) is redundant.

No one is stopping you, though.

Other things you can explicitly state, but don't need to:

  • call super() on the first line of a constructor
  • extends Object
  • implement inherited interfaces

Is there other rules that applies with an abstract interface?

An interface is already "abstract". Applying that keyword again makes absolutely no difference.

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...