given the following
test enum AccountType {
SAVING, FIXED, CURRENT;
private AccountType() {
System.out.println("It is a account type");
}
}
class EnumOne {
public static void main(
String[] args) {
System.out.println(AccountType.FIXED);
}
}
the answer is :Compiles fine and output is prints "It is a account type" thrice followed by "FIXED
quto source :http://www.javabeat.net/javabeat/scjp5/mocks/scjp_5_0_mock_questions_enums_part2.php
So i confused by when the enum constructor run..
Thanks
sun jiuzhen
[ March 13, 2008: Message edited by: sun jiuzhen ]