In many interviews I am facing these questions
1. Difference between abstract class and interface
We can declare methods virtually in a class and override them in child classes. Then why use of interface.
3. Why are you implementing all the interface methods even though you wont use them.
I know interface concept and abstract class concept but unable to understand their exact usage. I hope someone will explain me.
Rajanikant HawaldarPosted Sep 10, 2022, 12:34 PM
Farhan AhmedPosted Sep 11, 2022, 6:15 AM
Vishal YelvePosted Sep 10, 2022, 4:43 PM
Please refer Shivprasad Koirala sir's video, which will help you to clear your doubt.
https://youtu.be/0EnSPBVrbG0
Jayraj ChhayaPosted Sep 10, 2022, 8:03 AM
(1) Difference between abstract class and interface.
public abstract class Shape{
public abstract void draw();
}
public interface Drawable{
void draw();
}