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 string is a class?

0 Answers  


What is the final blank variable?

0 Answers  


What are the application of stack?

0 Answers  


what is default constructor and parameterised constructor with example?

1 Answers   KPIT,


Java does not support multiple inheritance. how interface helps in the same?

5 Answers   TCS,






How does thread synchronization occurs inside a monitor?

0 Answers  


What is meant by method overriding?

0 Answers  


what is meant by multicast?

1 Answers  


What is a condition in java?

0 Answers  


What are blocks?.

1 Answers   TCS,


Can memory leak happen java?

0 Answers  


Features of JAVA ? In which version of java synchronizedXXX() methods are included in Collections class.

1 Answers   NIIT,


Categories