What is the real use of interface in java apart from Multiple inheritance
"vijaya sankarj" wrote:
Way 1 : i can instantiate an object for class InterfaceTest at my class .
DISADVANTAGE : if you instantiate another object means its implicitly tells that you create an copy of InterfaceTest class. So it wont come under the category REUSE..
Way 2 : i can extend InterfaceTest in my class .......well done good but
DISADVANTAGE : If interfaceTest contains lot of methods other than m1 and m2 means you have to allocate memory for that methods also(waste na) in your class
Way 3 : USING INTERFACE >>>>>>
make m1 and m2 methods inside an interface (now see above program once again completely)
so you can accesses it from another class like extend but one small difference you are not pointing the unwanted method m3.....good luck.......
jacob deiter wrote:What is the real use of interface in java apart from Multiple inheritance,