The moose likes Beginning Java and the fly likes difference b/w interface & abstract Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "difference b/w interface & abstract" Watch "difference b/w interface & abstract" New topic

difference b/w interface & abstract

Balu Ramachandran

Joined: Oct 16, 2000
Posts: 16
please explain me the difference between interface and abstract
also explain complete defination for interface.
with regards,

Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Balu,
An interface can declare constants and methods with no implementation code. Any class implementing an interface must provide code for each method defined in the interface.
An abstract class can declare everything a regular class can as well as methods with no implementation code.
For a more complete description of how an interface works see this post
Hope that helps.


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Balu Ramachandran

Joined: Oct 16, 2000
Posts: 16
hi Jane Griscti,

thanks to ur's realy helpful to me
with regards,
Ira Jain
Ranch Hand

Joined: Sep 06, 2000
Posts: 70
I have created a list of differences between interfaces and abstract classes.It is :
Difference between abstract class and interface-----
Abstract Class Interface
----------------- -------------
-must not be instantiated -must not be instantiated
-may contain static and final data -variables are implicitly
static and final.The
modifiers which can be
used are public and final
-abstract class can have non-abstract -methods are implicitly
methods but, abstract method should be implemented in the
be inside an abstract class. subclass which
implements method
implementation strictly
in the interface.
-abstract method should not contain -methods in interface
any of these keywords - private, should not contain any of final,static, native, synchronized. these - protected,private,
final, static,native,
synchronized .
-methods are not implicitly public -methods are implicitly
public even if not
-is an incomplete class -specification or
prescription for behavior
-can extend only one parent class -can implement several
interfaces atonce
-can have constructors -interfaces can't
(should contain body) have constructors
-methods in it are given as- -methods in it are given as-
public void amethod(){} public void amethod();
Hope it helps u
Ira Jain
Ranch Hand

Joined: Sep 06, 2000
Posts: 70
Looks like the list of differences did not come out Ok .So if you would still like to have it ,I'll email it to you at your mail id.
I agree. Here's the link:
subject: difference b/w interface & abstract
It's not a secret anymore!