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
Give me some null interfaces in java?
Write a program to print 15 random numbers using foreach of java 8?
What is a byte string?
What is struts in java?
Write the algorithm to check the number non-leaf nodes in a tree.
Is heap stored in ram?
Is java jre still free?
Discuss about garbage collector in Java.
What are basic keywords?
Who is the owner of java?
What is nullpointerexception?
What is the full meaning of java?
what is enumset?
What is boolean false?
how to split string in java?