Interface ?

Explain interface with syntax ?

Last updated:6/15/2018 2:21:38 AM

1 Answers

Prakash nidhi Verma
Prakash nidhi Verma

Interface :

 An interface is a concept independent of the language. However,some languages like Java have interface as a language keyword which implement this general concept of  interface. An interface is a contract which an object promises to honor.'How' the contract is honored is up to the object but what it assures is the 'what' part of the contract. We can also say that an interface is the facade which the object puts up for the outside world to interrogate and interact. 

An interface is a set of methods or that's behavior and which the clients interact with the given class implementing the interface through intteractive class .  

Syntax for declaring the Interface : 

<interface name> { 
  return type method name1(Par1);   return type method name2(Par2); Final constant value N; }

Example :

interface readable{  
void read();  
class software implements readable{  
public void read()
public static void main(String args[]){  
software obj = new software();;  

output :   Mindstick.

Happy Coding :)