0 votes
1 view
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 (46.1k 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

0 votes
1 answer
asked Oct 17, 2019 in Java by Shubham (3.9k points)
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...