File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

interface and abstract class

 
Shilpa Jain
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can an abstract class implement an interface?
Thank you
 
Thomas Misik
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shilpa Jain,
I think the answer to that is yes because interfaces are abstract by default. Abstract classes are just templates you design yourself, so I don't see why you couldn't implement an interface (as long as the methods were left unwritten....public void actionPerformed(ActionEvent e){empty}). Since you are allowed to have non-abstract methods in an abstract class, and interfaces & their methods are assumed to be abstract, I can't see why you couldn't implement them. I could be wrong here, so maybe one of the Java gurus could post a definitive answer.
Regards,
Thomas
 
Thomas Misik
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NOTE: abstract methods CAN have regular methods, please disregard the comments on the interface method having to be empty.
Thomas
 
Shilpa Jain
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Thomas
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic