Wednesday, November 3, 2010

why interface inheritance is better ?

As much as i was convinced about it, i always got confused about this. Some useful links that would clarify :

http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html

Thursday, August 5, 2010

How to determine the OS from JAVA..

http://stackoverflow.com/questions/228477/how-do-i-programmatically-determine-operating-system-in-java

Wednesday, June 16, 2010

Abstract classes in JAVA..

Can abstract classes exist in JAVA without any abstract methods ?

The answer is yes. It made me curious as to why it was made technically possible in JAVA, while in C++ it is not the case [An abstract class must contain at least one pure virtual function ].

While it is a rare thing to happen and such a design should always be questioned to see if it is the right thing to do, one specific case where it is justified could be :

The abstract class partially implements an interface, with the intention that its subclasses must complete the interface. To take a slightly contrived motoring analogy, a Chassis class may partially implement a Vehicle interface and provide a set of core methods from which a range of concrete Vehicle types are extended. Chassis is not a viable implementation of a Vehicle in its own right, so a concrete Car subclass would have to implement interface methods for functional wheels, engine and bodywork.

from http://www.codestyle.org/java/faq-Abstract.shtml#whynoabstract !