• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is the difference between an empty interface and an empty abstract class ?  RSS feed

 
jose chiramal
Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please reply.
 
shan raj
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the FAQ JavaFAQ
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One's an interface, one's a class.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do a search for "marker interface" and "tagging interface", both different names for the same thing. There is an FAQ on JavaRanch about tagging interfaces: try this page. On Shan Raj's link, look at FAQ no 21. You may find something in Joshua Bloch's Effective Java, too
 
Sha Jar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jose chiramal wrote:Please reply.


The difference is that an empty interface will always only have abstract methods while and emply abstract class can have both abstract and concrete methods.

That's the difference between an interface and an abstract class. An interface is always completely abstract while an abstract class can potentially be mixed concrete or fully concrete.
 
Muhammad Khojaye
Ranch Hand
Posts: 449
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jose chiramal wrote:Please reply.

I don't know, why anyone want an empty abstract class. Anyhow, you can implement more then one empty interface, but the same condition does not hold for empty abstract class.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!