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 main method is called first in java?

0 Answers  


What is the difference between a static and a non-static inner class in java programming?

0 Answers  


Can java program run without jre?

0 Answers  


What is a dynamic array java?

0 Answers  


Tell me the Importent classes in net package?

0 Answers  


What is the purpose of object oriented programming?

0 Answers  


Explain notifyall() method of object class ?

0 Answers  


Explain different types of thread priorities ?

0 Answers  


What are the differences between include directive and include action?

0 Answers  


What do you mean by buffering?

0 Answers  


What’s the difference between the methods sleep() and wait()?

0 Answers  


How do you convert an int to a double in java?

0 Answers  


Categories