Answer Posted / mohd shakir
I think if you have basics knowledge of any OO language then you should be aware of basic definition of Interface and Abstract class.
Here I am going to explain when to use Interface and when to use Abstract class.
Abstract class:-> If you have a common functionality that is used by its subclasses then put that method in super abstract class(now you need not to define that common method in every subclass again and again) This is what you can't do with Interface(because all the methods are by default abstract).
Interface:-> If you don't have the scenario as I discussed above(in abstract class)then choose Interface.And you can also achieve multiple inheritance using Interface that is not possible in case of Abstract class.
| Is This Answer Correct ? | 21 Yes | 1 No |
Post New Answer View All Answers
What is locale?
What is the meaning of flag day?
What classes of exceptions may be caught by a catch clause in java programming?
What is java util list?
How do you test a method for an exception using junit?
When parseint method can be used?
What do you understand by final value?
Can a class be defined inside an interface?
Will the jvm load the package twice at runtime?
What is ctrl m character?
What is a class reference?
What is r * in math?
Describe the syntax of multiple inheritance? When do we use such an inheritance?
What is illegal identifier in java?
How to display all the prime numbers between 1 and n (n is the number, get the input from user)