Hi friends,
What is the use of interface in realtime environment?
plz answer.
Printable View
Hi friends,
What is the use of interface in realtime environment?
plz answer.
Krishna,
I think you are very much interested on realtime...
Interfaces as the name suggests is like a thing where you can can get a feel of the available business methods to interact, in fact the real execution will be defined somewhere else, which is not important to us, just like the keypad on your mobile. You just know how to use the keypad, forget about the real implementation or execution. It is like a way to interact with the system.
there are so many examples around you
1 . Based on the situation / Place u act differently
like, if u r at ur home or Company or among friends
u act differently
so thats a interface
2. Water can take different forms(ice, water, vapour) depending on the situation like cold , hot , or too hot
[B]interfaces:[/B]
- it contains methods and variables.
- variables may be abstact or final
- methods must be abstract type.
- access specifiers must be public.
[B]real time scenerio:[/B]
ex: there are two users(A,B) in one company but not at one place. however, B using the same class methods and A also want to use that at this scenerio intefaces are helpful. A and B both using same class but they are using diffrent methods in that class.
Hi..
This is sduam panigrahy
[U][B]USE OF INTERFACE IN REALTIME:[/B][/U]
i. Interface in java is used for implemntion the concept of polymerphism i.e a behaviour can behave differently depading upon the requirment. and situation where it is used.
i.e suppose i declared a interface called as calculateArea and in that i am declering a methood named as area. whennever i ll implement that interface as the rule of interface says that i have to provide the implementation for the area methood.
so if i implement that interface in Circle class then i ll provide the implementation for the area methood of interface as to calculate the area of the circle.
ii. And also java doesnot supports the concept of multiple inheritance, so interface is the alternative for that.