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