public class overLaod { public static void main(String[] args) { // TODO Auto-generated method stub print p1 = new print(); print p2 = new print("ads"); print p3 = new print("ads",555); p1.print(); p1.print("p1"); p1.print("p1",1); p2.print(); p2.print("p2"); p2.print("p2",2); } } class print { public print() { System.out.println("無參建構函式"); } public print(String str) { System.out.println("字串"+str); } public print(int num) { System.out.println("整型"+num); } public print(String str,int num) { System.out.println("字串"+str+",整型"+num); } public void print() { System.out.println("沒有返回值"); } public void print(String con) { System.out.println(con); } public void print(String con,int num) { System.out.println(con+" "+num); } }