This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes All abstract methods Vs interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "All abstract methods Vs interface" Watch "All abstract methods Vs interface" New topic
Author

All abstract methods Vs interface

Vikas
Ranch Hand

Joined: Dec 16, 2004
Posts: 63
Hi All,

This is really a beginners' question and my question is if an abstract class has all of its methods "abstract" in it(i.e. no concrete methods) then what will be the difference between this abstarct class and an interface.

Thank you
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37950
    
  22
If all your methods are abstract you are better off writing an interface, because you can implement several interfaces in the same class, but only extend one class. Remember you usually miss out "public" and "abstract" in method declarations in interfaces.
 
 
subject: All abstract methods Vs interface
 
Similar Threads
Have doubt in Interface.
Abstract Class & Interface
Difference between abstract and interfaces
interface and abstract
Interface methods