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 |
Why string is a class?
What is the final blank variable?
What are the application of stack?
what is default constructor and parameterised constructor with example?
Java does not support multiple inheritance. how interface helps in the same?
How does thread synchronization occurs inside a monitor?
What is meant by method overriding?
what is meant by multicast?
What is a condition in java?
What are blocks?.
Can memory leak happen java?
Features of JAVA ? In which version of java synchronizedXXX() methods are included in Collections class.