Created
March 30, 2010 16:15
-
-
Save koduki/349244 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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