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 is a list in java?
How to implement an arraylist in java?
Why does java have two ways to create child threads?
What do you understand by Header linked List?
What will happen to the exception object after exception handling?
Define how objects are stored in java?
Why super is first line in java?
Can an object subclass another object?
Explain what do you mean by functional overloading in java?
What is a protected class in java?
What is substring 1 in java?
How many bytes is a unicode character?
what is object slice?
Is string is a class in java?
Can we create a constructor in abstract class?