GeekInterview.com
Series: Subject: Topic:
Question: 44 of 1118

Interface and Abstract Class Usage

When will you use an interface and abstract class?
Asked by: Nishapanicker | Member Since Jun-2009 | Asked on: Sep 20th, 2010

View all questions by Nishapanicker

Showing Answers 1 - 3 of 3 Answers
Jansisenthil

Answered On : Oct 18th, 2010

View all answers by Jansisenthil

Abstract class is used when you expect lots of addition of methods in the later stages of your design. So that you can add methods without a change in subclasses that inherits the abstract class.

Interface is used when you want to implement the methods in different way in each class that implements the interface. For example a CAR interface with method speed can be implemented differntly in FORD, SKODA that implements the CAR interface.

Yes  3 Users have rated as useful.
  
Login to rate this answer.
deepthis594

Answered On : Dec 27th, 2010

View all answers by deepthis594

Interface is also used as an alternative to multiple inheritence in java

  
Login to rate this answer.

the simple way we can answer is in interface we can provide only abstract methods(i.e the methods with out any implementation) and in abstract class we have abstract methods as well as concreate methods (i.e methods with implementation) but abstract class cannot have multiple inheritance concept where as interface have multiple inheritance in java.

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.