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

What is a treeset class?

1 Answers  


How thread scheduler schedule the task?

1 Answers  


What is palindrome in java?

1 Answers  


What is the difference between scrollbar and scrollpane?

1 Answers  


What is a singleton class in Java? And How to implement a singleton class?

2 Answers  


What is meant by null and void?

1 Answers  


Is the milky way in a void?

1 Answers  


Can we extend a class with private constructor?

1 Answers  


How to create com object in Java?

1 Answers  


JVM responsibility?

6 Answers   TCS,


what is the final keyword denotes in java?

1 Answers   IBS,


What is composition in java?

1 Answers  


Categories