when to use abstract class and when to use interface?

Answer Posted / jc

If you want give different implementation(behaviour) to
methods which are available in the interface go for
interface.
If you want give different implementation to particular
methods(that is only some methods which are not similar to
subclass)go for abstract class.

Is This Answer Correct ?    0 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What will happen if non-synchronized method calls a static synchronized method and what kind of lock it acquires?

526


what are abstract functions?

575


Explain public static void main(string args[]).

573


What does += mean coding?

520


Explain about map interface in java?

599






What is the purpose of garbage collection in java, and when is it used?

575


Which collection is best for sorting in java?

707


What is Applet Stub Interface ?

1978


Can we overload the constructors?

569


What is java autoboxing?

543


How concurrent hashmap works?

623


Which collections are thread safe in java?

488


We are seeing so many videos/audios as many web sited. But question is these videos or audios are stored in Databases ( Oracle, Mysql, Sybase,... ) or stored any file directory from there they will give the link for that? Pls explain and give sample code to achieve this one? Thanks, Seenu.

1498


Can we use catch statement for checked exceptions when there is no chance of raising exception in our code?

600


What classes of exceptions may be thrown by a throw statement?

536