This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Empty abstract classs vs Empty interface

 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
whats a difference between an empty abstract classs and an empty interface?

Regards
 
fred rosenberger
lowercase baba
Bartender
Posts: 12086
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a single class, you can implement as many interfaces as you want, but you can only inherit from one abstract class.
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A friend of mine was asked this question and she replied the same as you mentioned. But he wasnt satisfied. So is there more to it than just one explanation.
 
Paul Clapham
Sheriff
Pie
Posts: 20764
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Who wasn't satisfied? Your friend is "she" so this "he" is a third person. Seems to me that's the person you should be asking.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, an empty interface has a special name (a "marker interface"), and the JDK contains a number of examples of how they used to be used, back before annotations were introduced in Java5. An empty abstract class -- well, that's just dumb
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic