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 loop means?
What is the difference between math floor and math round?
Can we use string in the switch case?
What do you understand by an io stream?
Explain the selection sort algorithm?
What is the difference between C++ and Java and your preferences?
How to instantiate member inner class?
What is use of a abstract variable?
What is Java Reflection API? Why it’s so important to have?
List types of storage classes in java?
What are the Static and Dynamic Variables? Differentiate them.
Describe what a thread-local variable is in java?
Why do we use regex?
Can a static class implement an interface?
What is public static?