本帖最后由 java冬冬 于 2013-5-17 16:39 编辑
- 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(super.num);
- }
- }
- class ExtendsDemo2
- {
- public static void main(String[] args)
- {
- Zi z = new Zi();
- z.show();
- //System.out.println(z.num+"...."+z.num);
- }
- }
复制代码
|
|