I have a class which is abstract which contains only the
abstract methods. This is similar to an interface. Then, if
i have given a choice to choose one of them. Which one i
have to choose and why?

Answer Posted / madhav

Interface is preferable to Abstract class as when ever in
instance is created for subclasses of this,constructors
will be called hirarchially consuming some time for each
constructor call..

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you take thread dump in java?

560


What is a Transient Object?

639


What is reverse function?

576


What are different types of expressions?

554


How do we access static members in java?

630






What is thread safe in java?

553


what is the swingutilities.invokelater(runnable) method for? : Java thread

550


what is mutual exclusion? : Java thread

556


What is a values collection view ?

685


State one difference between a template class and class template.

625


What is the main advantage of passing argument by reference?

505


What is the difference between heap memory and stack memory?

616


How do you calculate roots in java?

527


Explain the differences between static and dynamic variables?

588


why would you use a synchronized block vs. Synchronized method? : Java thread

537