📄 hide.java
字号:
//: c06:Hide.java
// From 'Thinking in Java, 2nd ed.' by Bruce Eckel
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
// Overloading a base-class method name
// in a derived class does not hide the
// base-class versions.
class Homer {
char doh(char c) {
System.out.println("doh(char)"+c);
return 'd';
}
float doh(float f) {
System.out.println("doh(float)"+f);
return 1.0f;
}
}
class Milhouse {
//System.out.println("Class Milhouse");
}
class Bart extends Homer {
void doh(Milhouse m) {System.out.println("Milhouse m");}
}
class Hide {
public static void main(String[] args) {
Bart b = new Bart();
b.doh(1); // doh(float) used
b.doh('x');
b.doh(1.0f);
b.doh(new Milhouse());
}
} ///:~
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -