构造函数在Java中重载 Java参数化构造函数 Java拷贝构造函数 构造函数在Java中重载 public class Tester { private String message; public Tester(){ message = "Hello World!"; } public Tester(String message){ this.message = message; } public String getMessage(){ return message ; } public void setMessage(String message){ this.message = message; } public static void main(String[] args) { Tester tester = new Tester(); System.out.println(tester.getMessage()); Tester tester1 = new Tester("Welcome"); System.out.println(tester1.getMessage()); } } Java参数化构造函数 Java拷贝构造函数