Interface Example Program in Java

Interface Example Program in Java. You can find Interface Example Program (code snippets) in this page.

Interface Example Program in Java. You can find Interface Example Program (code snippets) in this page.

interface Shape{

void draw();

}

class Rectangle implements Shape{

public void draw(){

System.out.println(“Drawing Rectangle”);

}

}

class InterfaceDemo{

public static void main(String args[]){

Shape shape=new Rectangle();

shape.draw();

}

}

Result:

Drawing Rectangle