本帖最后由 王琪 于 2014-6-8 21:35 编辑
- package dom;
- class myperson{
- private String name;
- private int age;
- private myperson(){
- System.out.println("****");
- }
- public void setName(String name){
- this.name=name;
- }
- public void setAge(int age){
- this.age=age;
- }
- public String getName(){
- return this.name;
- }
- public int getAge(){
- return this.age;
- }
- }
- class student extends myperson{
- private String school;
- public student(){ //这里出错,不通过
- System.out.println("##");
- }
- public String getSchool() {
- return school;
- }
- public void setSchool(String school) {
- this.school = school;
- }
-
- }
- public class text2 {
- public static void main(String[]args){
- student stu=new student();
- }
- }
复制代码 |
|