Monday, 12 October 2015

Interface example in java


public class First {

public static void main(String[] args) {
// TODO Auto-generated method stub
Second obj = new Third();
obj.display();
obj.fine();
}

}



public interface Second {
void display();
void fine();
}



public class Third implements Second{
public void display(){
System.out.println("One");
}
public void fine(){
System.out.println("Two");
}
}


output:-
One
Two

No comments:

Post a Comment