本帖最后由 Gump 于 2013-10-31 15:56 编辑
class Fu
{
private int num = 4;
public void setNum(int num)
{
this.num =num;
}
public int getNum()
{
return this.num;
}
}
class Zi extends Fu
{
//int num = 5;
void show()
{
System.out.println(num);
}
}
class ExtendsDemo2
{
public static void main(String[] args)
{
Zi z = new Zi();
z.show();
//System.out.println(z.num+"...."+z.num);
}
}
报错:num可以在Fu中访问private System.out.println(num);
|