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
How to sort double array in java?
What are the elements of java?
Is string a datatype?
Difference between collection, collection and collections in java?
How do you compare arrays in java?
What is java util list?
How do I compare two strings in word in java?
What is function and method in java?
How can constructor chaining be done by using the super keyword?
how a programmer confirms that the data submitted has been succesfully inserted into the database(either oracle or my sql).. How a programmer confirm if there is any problem with the program he wrote for insertion... ANS:--- >executeupdate method is having boolean return type, if anything goes wrong in data insertion or data updation, it would return false. otherwise, if it successfully inserts data into the database, it would return true NOW HOW TO I CHECK IN MY DURING EXECUTION WHETHER IT RETURNS TRUE OR FALSE... WELL IT WILL DISPLAY ANY MESSAGE OR NOT
What is difference between adapter class and listener?
Define max and min heap, also the search time of heap.
What is an anonymous class in java?
What are the advantages of exception handling in java?
What is the difference between jvm and jre? What is an interface?