What is advantage of interface in java?Plz help
Please explain in dumbest language possible.So i can understand
check this example
Code:
interface BaseInterface
{
int i=0;
}
interface BaseInterface2
{
int i=1;
}
class SubClass implements BaseInterface,BaseInterface2
{
public static void main(String args[])
{
System.out.println(BaseInterface2.i);
}
}
it works fine
Re: What is advantage of interface in java?Plz help
Hi
What would you do when someone asks you to buy 10 things or more than that which you can not hold it by your hands , certainely you will take help of some bag by which you will not worried about to hold 10+ things by your hand , now you just need to hold only that bag.
Now think about a situation when your friend suddenly come to your home and ask 5-6 things from that bag and you say yes i have those and i can give it to you but the condition is if you want 5-6 things you also need to carry other things too which ppl called contract which you must need to follow.
Please let me know how much i m correct to tell you about interface.
Re: What is advantage of interface in java?Plz help
This is a very old thread. Please check the date before posting and do not resurrect old threads. Closing this thread.