会计考友 发表于 2012-8-4 12:44:44

JAVA认证考试专业语言基础知识13

public int c;
    private String name;
    private int age;
    protected void setName(String name){
    this.name=name;
    }
    protected void setAge(int age){
    this.age=age;
    }
    protected void print(){
    System.out.println("Name="+name+" Age="+age);
    }
    }
    public class DemoSuper extends Person{
    public void print(){
    System.out.println("DemoSuper:");
    super.print();
    }
    public static void main(String[] args){
    DemoSuper ds=new DemoSuper();
    ds.setName("kevin");
    ds.setAge(22);
    ds.print();
    }
    }
页: [1]
查看完整版本: JAVA认证考试专业语言基础知识13