class mainClass
{
public static void main(String[] args)
{
System.out.println(args[0]);
try{
ISay obj=(ISay)Class.forName(args[0]).newInstance();
obj.say();
}
catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public interface ISay
{
void say();
}
class SayHello implements ISay
{
public void say()
{
System.out.println("Hello!");
}
}
class SayBye implements ISay
{
public void say()
{
System.out.println("Bye!");
}
}
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
你好呀,我是歪歪。 这次给你盘一个特别有意思的源码,正如我标题说的那样:看懂这行源码之后,我不禁鼓起掌来,直呼祖师爷牛逼。 这行源码是这样的: java.util.concurrent.LinkedBlockingQueue#dequeue h.next = …