It throws IllegalAccessException at line (2).
The behavior of JVM is not specified for such cases, it depends on implementation.
It prints account number in spite of private specifier.
It throws ClassNotFoundException at line (1).
JVM will refuse to run TestCreditCard as it uses CreditCard and
it should be recompiled to use newer version of CreditCard.
It throws SecurityException at line (2).
|