Intellipaat Back

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

I used the "pull interface" refactoring feature of Eclipse today to create an interface based on an existing class. The dialog box offered to create all the new methods of the new interface as "abstract" methods.

What would be the benefit of that?

I thought that the fact that you were allowed to declare interface methods as abstract was a superfluous and harmless feature of the language that is not particularly encouraged.

Why would Eclipse support such a style, or why would someone voluntarily choose to do so?

Clarification: I am not asking why interface methods are abstract, that is obvious. I am asking why one would explicitly choose to mark them as abstract since if they're in an interface they are abstract anyway.

1 Answer

0 votes
by (46k points)

According to the Java Language Specification, the abstract keyword for interfaces is obsolete and should no longer be used. (Section 9.1.1.1)

That said, with Java's propensity for backwards compatibility, I really doubt it will ever make a difference whether the abstract keyword is present.

Related questions

0 votes
1 answer
asked Sep 26, 2019 in Java by Shubham (3.9k points)
0 votes
1 answer
0 votes
1 answer
asked Sep 2, 2019 in Java by Anvi (10.2k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...