Skip to content

Instantly share code, notes, and snippets.

@koduki
Created March 30, 2010 16:15
Show Gist options
  • Save koduki/349244 to your computer and use it in GitHub Desktop.
Save koduki/349244 to your computer and use it in GitHub Desktop.
public class FactorySample {
static class Hoge{
public Hoge() {
System.out.println("Hello wold");
}
}
static <T> T as( Object o ) {
return (T) o;
}
static <T> T newInstance(Class<T> klass)throws Exception{
return klass.newInstance();
}
public static void main(String[] args)throws Exception {
Object x = newInstance(Hoge.class);
Hoge s = newInstance(Hoge.class);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment