wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes abstract class and interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "abstract class and interface" Watch "abstract class and interface" New topic
Author

abstract class and interface

Pankaj Wakchaure
Greenhorn

Joined: Jul 08, 2006
Posts: 4
Can anybody tell me all the differences between abstract classes and interfaces ?
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"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

Joined: Mar 06, 2001
Posts: 13459

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
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

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


SCJP, SCWCD.
|Asking Good Questions|
B Sriganesh
Greenhorn

Joined: Jun 24, 2007
Posts: 7
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

Joined: Jun 24, 2007
Posts: 7
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...
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 688

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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: abstract class and interface
 
Similar Threads
Tech Word Game
ABSTRACT
WA #1.....word association
difference between BufferedInputStream(or output) and other i/ostreams,regarding buffers.
Reg. native methods