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 a treeset class?
How thread scheduler schedule the task?
What is palindrome in java?
What is the difference between scrollbar and scrollpane?
What is a singleton class in Java? And How to implement a singleton class?
What is meant by null and void?
Is the milky way in a void?
Can we extend a class with private constructor?
How to create com object in Java?
JVM responsibility?
what is the final keyword denotes in java?
What is composition in java?