aspose file tools*
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


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "difference b/w interface & abstract" Watch "difference b/w interface & abstract" New topic
Author

difference b/w interface & abstract

Balu Ramachandran
Greenhorn

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

R.Balu
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


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

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

thanks to ur reply.it's realy helpful to me
with regards,
R.Balu
Bangalore.
india.
Ira Jain
Ranch Hand

Joined: Sep 06, 2000
Posts: 70
Hi,
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 it.no 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
specified
-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
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: http://aspose.com/file-tools
 
subject: difference b/w interface & abstract