黑马程序员技术交流社区

标题: 可能会有用 [打印本页]

作者: luojian    时间: 2016-4-14 14:18
标题: 可能会有用
public static void main(String[] args) {
                Student s = new Student();
                s.setName("张三");
                s.setSb(362.0);
                System.out.println(s.getName()+"..."+s.getSb());
        }
        String name;
        Double sb;

        public Student() {
                super();

        }

        public Student(String name, Double sb) {
                super();
                this.name = name;
                this.sb = sb;
        }

        public String getName() {
                return name;
        }

        public void setName(String name) {
                this.name = name;
        }

        public Double getSb() {
                return sb;
        }

        public void setSb(Double sb) {
                this.sb = sb;
        }
       
}

作者: zhongyuxin1011    时间: 2016-4-14 17:51
没有类名。类是继承的?构造函数带super();是在初始化父类?




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2