my dog learned polymorphism*
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 Android Security Essentials Live Lessons this week in the Android 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: 38075
    
  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.
 
wood burning stoves
 
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