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 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(); } }