Any one can explain how the inerface uses in java. give with
example.
Answer Posted / 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 |
Post New Answer View All Answers
What interface is extended by awt event listeners?
Explain about interthread communication and how it takes place in java?
What is the exact difference in between Unicast and Multicast object?
What is static in java?
Can we force the garbage collection to run?
What is == mean?
Write java program to reverse string without using api?
What is are packages?
How do I convert a string to an int in java?
What is byte [] in java?
Are global variables initialized to zero?
What are different types of arrays?
What is a flag value?
Explain different forms of polymorphism?
How do you use compareto?