Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.
When to use Interface over abstract class?
cannot make a object of this class or in other way cannot create
object by saying ClassAbs abs = new ClassAbs(); where ClassAbs is
abstract class.
Abstarct classes contains have one or more abstarct methods, ie method
body only no implementation.
Interfaces: These are same as abstract classes only difference is we
an only define method defination and no implementation.
When to use wot depends on various reasons. One being design choice.
One reason for using abstarct classes is we can code common
functionality and force our developer to use it. I can have a complete
class but I can still mark the class as abstract.
Developing by interface helps in object based communication.
Related Answered Questions
Related Open Questions