package day0725_6;
public class Person {
private String name;
private int age;
public Person(String name,int age) {
// TODO Auto-generated constructor stub
this.name = name;
this.age = age;
System.out.println("我是构造方法");
}
{
System.out.println("我是构造代码块");
}
static{
System.out.println("我是静态代码块");
}
}
package day0725_6;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
Person p1 = new Person("zs", 20);
Person p2 = new Person("lisi", 30);
}
}