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
Can we override compareto method?
Is java 9 released?
When do you get classcastexception?
What happens when you add a double value to a string?
Explain when noclassdeffounderror will be raised ?
List the interfaces which extends collection interface?
What is finalize method?
Is simpledateformat safe to use in the multithreaded program?
What does math floor () do?
How to convert string to char and vice versa?
What is arrays sort in java?
What are methods?
What is string pooling concept?
Can a abstract class be declared final?
Is a boolean 1 bit?