aspose file tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Abstract class or Interface? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Professional Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "Abstract class or Interface?" Watch "Abstract class or Interface?" New topic
Author

Abstract class or Interface?

Luna Bora
Ranch Hand

Joined: Jul 02, 2001
Posts: 34

I have an interface DBOperations which has all the public methods of Data class. This interface is implemented by two classes for local and remote modes. The client has an instance variable of type DBOperations so that it does not need to know whether the database is local or remote. Now, my question is, is it better to leave DBOperations as an interface or to change it to abstract class? What difference it makes if it is interface and if it is an abstract class? Thanks in advance for the help.
David Meyers
Greenhorn

Joined: Jul 03, 2001
Posts: 9
I would recommend in interface in cases where you aren't implementing any of the methods in the abstract class. This is because you can always implement multiple interfaces, but are limited to one extend.
Good luck
 
 
subject: Abstract class or Interface?
 
Threads others viewed
Question on SLSB Contract - SCBCD
An EJB can be local and remote at the same time
Almost ready to hand up: Just cleaning up and have a few questions
abstract Vs interface
Local/Remote implemetation Advice PLEASE !
MyEclipse, The Clear Choice