Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Abstract Classes & Interfaces

 
Prem Chand
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference b/w abstract classes and Interfaces?
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds more like it belongs in the beginner's forum. I will move it there for you.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The basic difference is that with an abstract class you can define implemented methods along with abstract methods. With an interface you can only define abstract methods, although you don't need to use the abstract keyword.
Another key difference is that a class can only inherit from one other class. It can implement multiple interfaces. Use interfaces if you need that type of behavior.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd suggest that you try a quick search on each of the three Java in General forums and the OO forum for this topic as it has been discussed here a few times already.
Note that the search page link is at the top right of this page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic