when,where and how to use abstract class and interface

Answer Posted / prapanch

if the developer wants some methods which are implemented
in the super class and some methods which will be
implementd by him then he will go for abstract class.
because in abstact class all methods need not to be abstact
in nature. but in interface all the methods must be
abstract and so the developer will not get any implemented
code from the interface. you will use interfaces when two
different teams are working for a same requirement then an
interface will act like a medium with which they can
interact and all the teams will be in line.so your team and
other team will implement the same method names but with
difffeerent implementation code.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is treeset sorted in java?

794


How does indexof work?

752


What will happen to the exception object after exception handling?

809


What is the point of polymorphism java?

785


What is ascii code?

866


What is style and indentation?

790


Is null false in java?

979


State two differences between C and Java.

998


What is difference between equals and hashcode method?

818


how to split string in java?

896


Explain super keyword in java.

846


Is main a function?

744


Is it possible to use string in the switch case?

826


How can we avoid including a header more than once?

819


What are latest features introduced with java 8?

842