File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes what s the difference between abstract class and interface? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what s the difference between abstract class and interface?" Watch "what s the difference between abstract class and interface?" New topic
Author

what s the difference between abstract class and interface?

pinakin raval
Greenhorn

Joined: Jun 28, 2005
Posts: 5
what is the difference between abstract class and interface?
Dave Wingate
Ranch Hand

Joined: Mar 26, 2002
Posts: 262
An interface provides a contract that all implementing classes must meet. If a class is declared to implement an interface, then it must provide an implementation for each method defined in the interface.

An abstract class is similar in that it may declare abstract methods whose implementation is defered to child class(es). An abstract class cannot be instantiated. Sometimes it is useful to use abstract classes becausem unlike interfaces, you can include method implementations for no abstract methods that will be common to all child classes (assuming you don't override them).


Fun programming etcetera!
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

Moving to JiG(Beginner).


[Jess in Action][AskingGoodQuestions]
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
http://faq.javaranch.com/view?InterfaceVsAbstractClass


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what s the difference between abstract class and interface?