Any one can explain how the inerface uses in java. give with
example.
Answer / yogesh sanas
Interface is a contract between class and interface. Interface has some public abstract methods which class needs to be implement.
We can achieve polymorphism using Interface.
e.g.
Interface Interface_Name(){
int add(int x, int y);
}
Class MyClass implements Interface_Name{
public int add(int x, int y){
return x+y;
}
}
| Is This Answer Correct ? | 0 Yes | 1 No |
What is the difference between variable & constant?
How we can make copy of a java object?
Is ++ operator thread-safe in java?
What does || mean in vectors?
how to handle http request in struts
what are the diffrences between interface and abstract class?
Relationship between an event-listener interface and an event-adapter class?
int a=10,b=20,c=30 a= b+c;b=a+c;c=a+b; System.out.println("The value is"+a+b+c;
What is difference between static method and static variable?
Explain enumeration in java?
Tell us something about different types of casting?
all are saying java doesn't support multiple inheritance but by default Object class is super class for all the user defined classes and we can extend atmost one class so each class can extend more than one class so java supports multiple inheritance?i am confused with this,pls any one explain me.