Saturday, January 12, 2013

InterfaceCastingExample


package com.interfaces;


interface FirstInterface{
void show();
}

interface SecondInterface{
void show();

void display();
}


public class InterfaceCastExample implements FirstInterface,SecondInterface{

public void show() {
System.out.println("Show method content");
}


public void display() {
System.out.println("Inside display method.........................");
}

public static void main(String args[]) {

FirstInterface fi = new InterfaceCastExample();

fi.show();

SecondInterface si = new InterfaceCastExample();

si.show();


InterfaceCastExample ic = (InterfaceCastExample)si;

ic.display();

}

}

No comments:

Post a Comment