本帖最后由 杨洋 于 2012-7-20 10:05 编辑
class Worker
{
}
class Student
{
}
class Tool
{
private Object obj;
public void setobject(Object obj)
{
this.obj=obj;
}
public Object getObject()
{
return obj;
}
}
class GenericDemo3
{
public static void main(String[] args)
{
Tool t = new Tool();
t.setObject(new Worker());
Worker w = (Worker)t.getObject();
}
}
代码我对了几遍都一样,就是文件名不一样,为什么我的就报错,怎么更正呢
|
|