这是代码和运行结果
public class 私有构造 {
private String name="";
private int age=22;
private double weigh=150;
private double high=175.0;
static 私有构造 me=new 私有构造("张三",21,140,175);
//静态初始化块
static
{
System.out.println("这是静态初始化块。");
}
//私有构造
private 私有构造(String name, int age, double weigh, double high) {
System.out.println("这是私有构造。");
this.name = name;
this.age = age;
this.weigh = weigh;
this.high = high;
}
//初始化块
{
System.out.println("这是初始化块。");
}
//无参构造
public 私有构造() {
System.out.println("这是无参构造");
}
public static void main(String[] args) {
System.out.println("姓名:"+me.name+"的身高是:"+me.high);
}
}