view 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 source

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();
}