代码演示 class Person{private String name;private int age;Person(){System.out.println("person run");}public void speak(){System.out.println(name+":"+age);}}class ConsDemo{public static void main(String[] args) {Person p = new Person();/
class Person { private String name; private int age; Person() { System.out.println("person run"); } public void speak() { System.out.println(name+":"+age); } } class ConsDemo { public static void main(String[] args) { Person p = new Person();//此时调用了构造函数 p.speak();//调用两次speak方法 p.speak(); } }