super代表父类对象 在NewTel 类中要使用super调用Tel的话,NewTel得继承Tel
- class Tel
- {
- void show()
- {
- System.out.println("number");
- }
- }
- class NewTel extends Tel
- {
- public void show()
- {
- //System.out.println("number");
- super.show();
-
- System.out.println("picture");
- System.out.println("name");
- }
- }
- class Demo1
- {
- public static void main(String[] args)
- {
- NewTel n=new NewTel();
- n.show();
- }
- }
复制代码 |