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 encapsulation in java? Explain
Can anonymous class have constructor?
Can a class have 2 constructors?
Explain working of call by reference function invoking.
What variables are stored in stack?
What are keywords give examples?
Can a boolean be null java?
What is internal variable?
What are the major advantages of internal iteration over external iteration?
Is zero a positive integer?
What will be the output of round(3.7) and ceil(3.7)?
Is a boolean variable?