AZZA 釋出 CAST 鋁合金機箱:中開門設計,支援 90° 擺放
阿新 • • 發佈:2021-02-03
技術標籤:java
class Student{
private int age;
String name;
double score;
Student(){
System.out.println("構造方法一被呼叫");
}
Student(int newage, String newname){
System.out.println("構造方法二被呼叫");
age = newage;
name = newname;
}
Student(int newage, String newname, double newscore){
System.out.println("構造方法三被呼叫");
age = newage;
name = newname;
score = newscore;
}
}
public class Test {
public static void main(String[] args) {
Student stu1 = new Student();
Student stu2 = new Student(18, "czx");
Student stu3 = new Student(18, "czx" , 99.5);
}
}
執行結果