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 method in coding?
What is pass by value?
What is an example of declaration?
How many bytes are there?
What is the difference between throw and throws keywords?
What is the use of bufferedreader?
What is the use of a conditional inclusion statement in Java ?
How is abstraction implemented in java ?
What is meant by structural programming?
Why do I need to declare the type of a variable in java?
How many types of interfaces are there?
How long will it take to learn java?
What java ide should I use?
Why is a string immutable?
how to write a program for sending mails between client and server