Mercurial > hg > Members > shoshi > TreeCMSv2
diff src/treecms/test/GenericsTest.java @ 11:85061e874775
commit
author | shoshi |
---|---|
date | Fri, 06 May 2011 00:42:57 +0900 |
parents | |
children | 8bf59f161b23 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/treecms/test/GenericsTest.java Fri May 06 00:42:57 2011 +0900 @@ -0,0 +1,32 @@ +package treecms.test; + +import java.util.ArrayList; +import java.util.List; + +public class GenericsTest<E extends Foo> +{ + public static void main(String _args[]) + { + GenericsTest<Hoge> h = new GenericsTest<Hoge>(null); + } + + public GenericsTest(E _instance) + { + E kasu = (E)_instance.get(); + } +} + +interface Foo +{ + public Foo get(); + public List<Foo> list(); +} + +interface Hoge extends Foo +{ + @Override + public Hoge get(); + + @Override + public List<Foo> list(); +} \ No newline at end of file