This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Abstract Classes & Interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Abstract Classes & Interfaces" Watch "Abstract Classes & Interfaces" New topic
Author

Abstract Classes & Interfaces

Prem Chand
Greenhorn

Joined: Nov 13, 2002
Posts: 3
What is the difference b/w abstract classes and Interfaces?
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
This sounds more like it belongs in the beginner's forum. I will move it there for you.


Matthew Phillips
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
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

Joined: Dec 10, 2001
Posts: 7023
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.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
Consider Paul's rocket mass heater.
 
subject: Abstract Classes & Interfaces