• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

difference b/w interface & abstract

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
please explain me the difference between interface and abstract
also explain complete defination for interface.
with regards,
R.Balu
Bangalore
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Balu Ramachandran
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Jane Griscti,

thanks to ur reply.it's realy helpful to me
with regards,
R.Balu
Bangalore.
india.
 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
You guys wanna see my fabulous new place? Or do you wanna look at this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic