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 in java?
What is this keyword used for?
What is java lang object?
What is the difference between Static and final?
What are some alternatives to inheritance?
How do you declare an array that will hold more than 64KB of data?
how to run servlet program between two computer through the internet ?
2 Answers Kiran Prakashan, TCS,
What are the characteristics of Final,Finally and Finalize keywords.
How do you differentiate abstract class from interface?
Can we add two byte variables and assign the result to a byte variable ? b=b1+b2 where b,b1,b2 are byte types
Which method is used to find that the object is exited or not?
What are thread local variables?