when to use abstract class and when to use interface?
Answer Posted / mohit jethva
In Interfate you are restricting a user to impement each
and every method of interface so if you have a requirement
which is constantly changing so don't prefere interface.
While in Abstract Class user don't need to implement each
and every method which is not required or marked with
mustoverride.
And by using interface you can achive multiple inheritance
in C# but with Abstact class it's can't be achive
| Is This Answer Correct ? | 31 Yes | 21 No |
Post New Answer View All Answers
What is broken and continue statement?
How will you initialize an Applet?
Can an anonymous class be declared as implementing an interface and extending a class in java programming?
Why we override equals() method?
What is an example of a boolean?
Explain features of interfaces in java?
What is singleton class example?
Can we serialize singleton class?
What is a get method?
Can sleep() method causes another thread to sleep?
Is string a wrapper class?
What is the set interface in java programming?
What is the difference between int and integer in java?
Is math class static in java?
Write a method to check if input string is palindrome?