Win a copy of Functional Design and Architecture this week in the Functional programming 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

abstract class and interface

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anybody tell me all the differences between abstract classes and interfaces ?
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"pankajspace pankajspace",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted, often without warning

thanks,
Dave
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by pankajspace pankajspace:
Can anybody tell me all the differences between abstract classes and interfaces ?



I don't think so. You are welcome to search this forum for previous discussions though, you may find them useful. Trying to repeat old conversations is not time well spent.

Dave
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Welcome to JavaRanch.
This topic is already discussed a lot of times, so I think that you will get a link to the latest discussion.
But in short I would like to say that interfaces declare only what needs to be done, but abstract classes can tell partially how it can be done.

This should five you a hint but you'll come to know more about it later.

And I think that your name does not follow the naming conventions followed here. Please check it. You will get a message saying do from one of the senior members.

Hope this helps
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another difference is that in a interface the members are by default public ,static and final which is not the case in an abstract class...
 
B Sriganesh
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another difference is that in an interface the members are by default public ,static and final which is not the case in an abstract class...
 
Ranch Hand
Posts: 694
Mac OS X Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Another difference is that in a interface the members are by default public ,static and final



This is true of data member in an interface which means that you cannot have any instance variables in interfaces but only constants -- even if the declaration looks like an instance variable, it is implicitly public static and final meaning that all data members of interfaces are public constants.

Method members, on the other hand, are implicitly public abstract and not ever static. Methods of interfaces cannot be static because methods of interfaces must be overriden, since they are abstract, and static methods cannot be overriden but only redefined.

Kaydell
[ June 24, 2007: Message edited by: Kaydell Leavitt ]
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic