• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

interface and abstract class

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can an abstract class implement an interface?
Thank you
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Thomas
 
reply
    Bookmark Topic Watch Topic
  • New Topic