For those out there who know English - I'd like your opinion...
 
This is more a Java question than EJB, but relevant nonetheless...
 
If you are familiar with Bruce Eckel's Java Bible (http://www.mindview.net) Thinking in Java - you'll notice that he is quite adamant about the use of interfaces as a contract for those who implement it - and that it doesn't carry any implementation.  Its purpose is to manage new subclasses and stating to the world that if you implement an interface, you will have at least your own implementation of those interface methods. THis, of course, is the mechanism that gives us the power of dynamic binding.
 
Given this... I was digging through the java.sql.* package and found several classes - INTERFACES - that HAVE implementation defined. java.sql.callableStatement for example.
 
I can understand we would want to override methods in callableStatement if we want to make our own subclass of it ...but I would expect this to be a normal class and then I would extend it with my own.  More so, I didn't think you could even compile a class defined as an interface if it contained method implementation. Going to start some of my own tests now to prove this, but anyone know why CallableStatement and others would be interfaces rather than normal classes.  And is this more common than I thought?
 
Thanks,
Chris

Responder a