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
Explain serialization and deserialization in java?
Can a function return a function?
What is the difference between checked exception and unchecked exception?
Is main is a keyword?
What state is a thread in when it is executing?
Can It is possible to synchronize the constructor of a Java Class?
What are different data types?
What is the difference between the size and capacity of a vector?
What does \ mean in regex?
How do you escape a string?
What are strings in physics?
What is difference between identifier and variable?
What is the best definition for data?
What is a boolean flag in java?
Explain restrictions for using anonymous inner classes?