Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Abstract class and Interface

 
saravana kumar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can a abstract class exist without abstract method ?
is it possible a interface class has empty body ?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can have an abstract class with no abstract methods. Yes, you can have empty interfaces -- like java.lang.Cloneable and java.io.Serializable.
 
Phani Kumar
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have interface without body and it has got a special name "Marker interface"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic