This week's book giveaway is in the JDBC and Relational Databases forum.
We're giving away four copies of Murach's MySQL and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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

Abstract class and interface.

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ANY BODY CAN TELL WHAT IS THE EXACT DIFFERENCE BETWEEN ABSTRACT CLASS AND INTERFACE???
wHERE THESE ARE USE??WHERE NOT USED
[ September 02, 2005: Message edited by: Barry Gaunt ]
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Abstract classes and interfaces cannot be instantiated

Abstract class can contain non abstract methods while interface cannot contain any non abstract methods

Interface should contain all public members while abstract classes can have public, protected, default and private members.

These are the major differences.

Swapna
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shinu R, please read our JavaRanch Naming Policy and change your displayed name to comply. We need a displayed name in the format <first name><space><family name>, preferably your real name.

And please do not post in capital letters, there is no need to draw attention to yourself in this impolite way.
Thanks,
-Barry

(NR)
[ September 02, 2005: Message edited by: Barry Gaunt ]
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
interface cann't be protected or private but it can be default or public .
abstract class can have all access modifiers.
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Abstract classes are usually the Parent classes Ex. class Animal. Then you probably would have a subclass Canine Extends Animal. Then after that you may have a class Dog Extends Canine Implements Pet. The Pet Interface which you can use to be implemented on all Animal subclasses regardless of be them being class Bird for example that would implement the Pet Interface.

Now imagine you have an Animal class which is not abstract, then you may be able to create a new Animal object. But what animal could this be? So it would be better to have an abstract class Animal, which can be extended but not instantiated.
[ September 03, 2005: Message edited by: Megs Maquito ]
 
kailash mehra
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi interface can not be private and default but abstract class can have all access modifier's
 
reply
    Bookmark Topic Watch Topic
  • New Topic