JAVAの構造方法

2857 ワード

package first;
//    
public class Function {
//                ;            ,              :
//           ;            ;       static final     。

    int age; //   
    String name; //   
    String position; //   
    String education; //   
    //      (      ):  ,source,general constructor using Filds    
    public Function(int age, String name, String position, String education) {
        super();
        this.age = age;
        this.name = name;
        this.position = position;
        this.education = education;
    }
    public Function() {

    }
    //    ,            ,                 ;
    //                  ,                         :
    //            ,               ,            :
    public Function(int age) {
        this.age=age;
    }
    public Function(int age,String name) {
    //         :          ,            ,       this      
        this(age);
        this.name=name;
    }
    public static void main(String[] args) {
    //  new         ,          (       )    。  Teacher         ,  Teacher               。
        Function teacher = new Function();
        teacher.name = "  ";
        teacher.age = 36;
        teacher.education = "  ";
        teacher.position="teacher";
    }

}