public class T_1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
T_1_B b = new T_1_B();
b.showName();
T_1_A a = b;
a.showName();
try {
a.getName(); // error
} catch (Exception e) {
out.println(e);
}
}
}
//--------------------------------
class T_1_A {
String name = "G";
void showName() {
out.printf("A(%s)\n", name);
}
}
//--------------------------------
class T_1_B extends T_1_A {
void showName() {
String _name = this.getName();
out.printf("B(%s)\n", name);
}
String getName() {
return name;
}
}