Interface Example Program in Java

By | December 17, 2010
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

Leave a Reply

Your email address will not be published. Required fields are marked *