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 does ide stand for?
Why scanner is used in java?
when to use ArrayList and when to use HashMap in webApplication.
Which are different kinds of source code?
Convert a BST into a DLL and DLL to BST in place.
Can we create constructor in abstract class ?
What is considered an anti pattern?
How a string is stored in memory?
What is the difference between the final method and abstract method?
What is the symbol for line break?
How can you read an integer value from the keyword when the application is runtime in java? example?
What are triggers in DB? Explain their types. How do they work?
How to create com object in Java?
What are java threads?
Why is string buffer better than string ?