📄 staticdemo3.java
字号:
class A1{
int x=10;
void show(){
System.out.println("father");
}
}
class StaticDemo3 extends A1{
static int x=100; //加不加static都可编译通过, ;int x 正确
void show(){
System.out.println("son");
}
void show(int x){ //去掉参数就必须加上static
System.out.println("x= no static "+x);
}
static void show(float f) {
System.out.println("f="+f);
}
void show(double d) {
System.out.println("d="+d);
}
public static void main(String s[]){
//System.out.println(A1.x);
//show();
show(55.00f);
StaticDemo3 oo=new StaticDemo3();
System.out.println(oo.x);
//A1.show();
oo.show(888);
oo.show(33.0000);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -