Java code,java,Example,Tutorials,Syntax,Hibernate,Jsp, Servlet, FileHeadling,Java or Core Java Tutorial or Java Programming Tutorial is a widely used robust technology. learning of java from basic questions like what is java tutorial, core java, where it is used, what type of applications are created in java and why use java.

Search This Blog

Tuesday, 5 July 2016

What Is Interface

What Is Interface?

   
      Interface in java is core part of programing,java is advance concept use Interface.it use that use the key word of INTERFACE.
         main use  of interface is java is not support  multiple inheritance so avoid this problem java is use interface but interface is only  Implement it can not extends like class

      we can use multiple interface it must be implement.interface only deceleration part  inside  a  interface

  Syntax
 
    public interface one
 {
     //method name
}
example

  interface one
{

void show();
void disply();
void ex();
}
 
Example of Interface?


    Interface is not a class.
    java is not support multiple inheritance so class is extends it will not implement.
                          so avoid this drawback java is use the interface it can be not Extends .
interface must be Implement .
     EXAMPLE

interface Animal {

   public void eat();
   public void travel();
}
 
 
public class VIPUL implements Animal{

   public void eat(){
      System.out.println("Mammal eats");
   }

   public void travel(){
      System.out.println("Mammal travels");
   } 

   public int noOfLegs(){
      return 0;
   }

   public static void main(String args[]){
      VIPUL = new VIPUL();
      m.eat();
      m.travel();
   }
} 
 
Share:

Agravat &Google

Total Pageviews

Blog Archive

vipul c.Agravat . Powered by Blogger.

myjava

myjava
java

myimg

myimg
good

Translate

Recent Posts

Unordered List

Definition List

Pages

Theme Support