1.如果在类中没有谢构造方法,编译器回默认生成一个构造方法,该构造方法除了创建对象,什么也不做,但是一旦写了一个构造方法,编译器便不生成;
// the default constructor is like this
public Person{
private String name;
public Person(){}
};
2.构造方法是可以重载的
public Person() {
System.out.println("Constructor is being using!");
}
public Person(String name, int age){
this.name = name;
this.age = age;
}