I know what is abstract class and interface, but i want to know the real time example where we use these both
Question asked by visitor Bhuvaneswari
I know what is abstract class and interface, but i want to know the real time example where we use these both
Question asked by visitor Bhuvaneswari
u mean a real world or real time.Real time has a different meaning and i guess java is not used for real time applications(C/C++)
hi,
when ever there is need of having same common features among the subclasses of of super class we have to go for AbstractClass, when ever there is no common features for subclasses of super class we have to go for interface
the most real time example of abstract class and interface is bulding a house
1)concrete methods are explained with completed house.
2)abstract classes are explained with completed house but a little bit of work left
3)interfaces are explained with taking a building plan
Well Guys
Don't brush in the air,I mean to know better about two key words start using/studying the codes only then you can have good picture about the strengths between the inheritance and interface.
To feel any loveliness you should start using it. ha ha ha
By
Venky
When you are making a program for a real time meaning say Building; you create a class say House and then another say Shop both extend Building but you decide to make Building as an abstact class as when you create an object of the building class you don't know which kin of object it will be; will it be house or shop so the program fails and you say ah it is good that this class is made an abstract as we shouldn't create an object of this class.
Interface is a 100 % pure Abstract class means it is a class which is 100 % abstract in nature i.e 100 % unknown what it does.