构造器调用构造器——《Thinking in Java》随笔003

package cn.skyfffire;

import java.util.Date;

/**
 * 
 * @author skyfffire
 *
 */
public class Test {
    String name;
    Date birthDay;
    
    Test(String _name) {
        name = _name;
    }
    
    Test(String _name, Date _birthDay) {
        /* 此处调用了构造函数, 简化了编写过程,但只能是第一个语句调用构造函数 */
        this(_name);
        birthDay = _birthDay;
    }
    
    public static void main(String[] args) {

    }
}
原文地址:https://www.cnblogs.com/skyfffire/p/6444271.html