If interface & abstract class have same methods & abstract class also not contain any implementation for those methods which one you prefer ?

Use abstract class because we implement only requried methods of abstract class but for interface we must implement all methods whether or requried or not

Questions by tulasi   answers by tulasi

Showing Answers 1 - 6 of 6 Answers

Mujeeb

  • Oct 31st, 2005
 

Obviously one should ideally go for an interface.Coz as we all know one can only extend just 1 class , where as one can implement as many interfaces as one can.And in case the class under contention has got some threads to invoke or if it is some JFrame kind of class then obviously it would make sense to use the interface.

  Was this answer useful?  Yes

srikanthboddu

  • Nov 6th, 2005
 

implementing an interface for a class is very much effective ratherthan extending an abstract class bcause we can extend some other useful class for this subclass

mandyjoshi

  • Nov 11th, 2005
 

It depends on your design. But if your basic question is, if you want to declare method without implimenation, (which must be implemented by child) where you will prefer to put. Then answer in Interface.

  Was this answer useful?  Yes

msarada

  • Aug 24th, 2006
 

if we want to have all the other properties of the abstract class along with the unimplemented methods, then we prefer an abstract class otherwise we go for an interface(in order to have multiple inheritance).

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions