import staticを使うことで、CURRENTという省略した指定が可能になる
▪️Test92.java
import B.Test92accountType;
import static B.Test92accountType.CURRENT;
import static B.Test92accountType.TERM;
public class Test92 {
private String accountNo;
private Test92accountType accountType;
private int balance;
public Test92(String accountNo, Test92accountType accountType) {
}
public static void main(String[] args) {
Test92 customer = new Test92("12345", Test92accountType.ORDINALLYSAVINGS);
Test92 customer2 = new Test92("21456", CURRENT);
Test92 customer3 = new Test92("33332", TERM);
Test92 customer4 = new Test92("77772", Test92accountType.TERM);
}
}
▪️Test92accountType.java
package B;
public enum Test92accountType {
// 指定した種類の値だけ入れることができる列挙型を定義
ORDINALLYSAVINGS, CURRENT, TERM;
}
▪️Test92.java 実行結果