嗨! 我是一個給Java嘗試的C#人..所以我如何在Java中做以下事情。
在C#public T create_an_instance_of<T>(){
T instance = default (T);
// here's usually some factory to create the implementation
instance = some_factory.build<T>();
// or even..
instance = some_factory.build(typeOf(T));
return instance;
}
備案,這將不會編譯,因爲例外;) – Bozho 2010-05-09 14:25:16
和備案,downvote不是我的。好像所有的答案都被低估了。 – Bozho 2010-05-09 15:22:40