Any one can explain how the inerface uses in java. give with
example.



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

Post New Answer

More Core Java Interview Questions

Why do we declare a class static?

0 Answers  


How do you use substring in java?

0 Answers  


Can list be null in java?

0 Answers  


What are the three types of design patterns?

0 Answers  


What is unicode with example?

0 Answers  


What is the right data type to represent a price in java?

0 Answers  


Which software is used for java programming?

0 Answers  


How to perform linear search in java?

0 Answers  


What do you mean by collectors in java 8?

0 Answers  


What are the differences between heap and stack memory?

0 Answers  


What is the significance of continue jump statement? Explain with an example.

0 Answers   Amdocs,


what is the use of clone() in real time scenario?

2 Answers   Quinnox,


Categories