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
How do you do absolute value in java?
What is integer size in java?
How objects of a class are created if no constructor is defined in the class?
What is a default constructor and also define copy contrucyor?
I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?
What is arguments in java?
What lambda means?
can any body body expalin best definitions & best real time exaples for opps concepts.
What is math in java?
Explain tree set and its features?
What is reflexive association?
What is local class in java?
How do you sort a string in alphabetical order in java?
What is the difference between preparedstatement and statement in java?
When is the garbage collection used in Java?