When we will use an Interface and Abstract class?

Answer Posted / devendra.m

Both Absstract classes and interfaces can be used when there
is a difference in subclass types.
When subclass type is totally different then implement the
interfaces.When subclass type is partially common in the
super type then extends the abstract class.Internally some
comman behaviour is there incase of abstract classes.
incase of interface we can achieve multiple inheritace.but
incase of classes we can not achieve multiple inheritace.

Is This Answer Correct ?    9 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you read content from file in java?

599


What is hashset in java?

530


How can we avoid including a header more than once?

613


What is java ceil?

572


What state does a thread enter when it terminates its processing in java programming?

578






Explain restrictions on using enum?

634


How can we access some class in another class in java?

555


What is a nested structure?

537


What is this () in java?

579


What is the purpose of nested class in java?

599


What do you understand by abstract classes?

602


How do I know if java is installed?

519


What is thread count in java?

547


can rmi and corba based applications interact ?

670


When does a class need a virtual destructor?

532