- package com.itcast.practise;
- public class Demo2 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Sun sun = new Sun();
- sun.show();
-
- }
- }
- abstract class Father{
- abstract public void show();
- public String name = "456";
-
-
-
-
- }
- class Sun extends Father{
- //super.name = "haha";
- String str = super.name; //这里不能用super.name = "haha" 应该是为了保护父类中的变量
- @Override
- public void show(){
- System.out.println(super.name);
-
- }
- }
复制代码 |