自行编写java的构造函数
1 public class Duck { 2 public Duck(){ 3 System.out.println("I'm constructing!"); 4 } 5 public static void main(String[] args) { 6 Duck d = new Duck(); 7 } 8 }
1 public class Duck { 2 public Duck(){ 3 System.out.println("I'm constructing!"); 4 } 5 public static void main(String[] args) { 6 Duck d = new Duck(); 7 } 8 }