Interface ?

Total Post:113

Points:791
 252  View(s)
Ratings:
Rate this:

Explain interface with syntax ?

  1. Post:140

    Points:984
    Re: Interface ?

    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()
    {System.out.println("Mindstick");}  
    public static void main(String args[]){  
    software obj = new software();  
    obj.read();  
     }  
    }  
    

    output :   Mindstick.

    Happy Coding :)

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!