//type casting
class One
{
void show1()
{
System.out.println("--------Super-------");
}
};
class Two extends One
{
void show2()
{
System.out.println("--------sub----------");
}
};
class Narrowing
{
public static void main()
{
One o;
o=(One)new Two();
o.show2();
}
};
No comments:
Post a Comment