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 an empty string in css?
Is singleton a bad practice?
What is locale in java?
What does isempty () do in java?
How to find the index of the largest number in an arraylist java?
Why is whitespace important?
What is the final blank variable?
What is difference between fileinputstream and filereader in java?
What is an abstract method in java programming?
What is treemap in java?
What is public/private protected in java?
What are local variables?
Can we sort array in java?
What are the advantages of passing this into a method instead of the current class object itself?
Can we extend private class in java?