public class hello {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String arg1="world!";
System.out.printf("hello %s\n", arg1);
CBase obj;
obj=new CDerive1();
obj.say_sth();
obj=new CDerive2();
obj.say_sth();
}
}
interface CBase{
void say_sth();
}
class CDerive1 implements CBase{
@Override
public void say_sth()
{
System.out.printf("CDerive1\n");
}
}
class CDerive2 implements CBase{
@Override
public void say_sth()
{
System.out.printf("CDerive2\n");
}
}
/*
hello world!
CDerive1
CDerive2
*/