在千锋“逆战”学习第 2天,
假如我不能,我一定要;假如我一定要,我就一定能
7.('final 属性初始化)
C
8.(final 变量)
A
9.(final 修饰引用)
C
10.(final方法,方法覆盖)
public static void main(String[] args) {
Sub s=new Sub();
s.m1();
s.m1(10);
s.m1(1.5);
}
class Super{
public final void m1() {
System.out.println("m1()in Super");
}
public void m1(int i) {
System.out.print("m1(int) in Super");
}
}
class Sub extends Super{
public void m1(int i) {
System.out.println("m1(int)in Sub");
}
public void m1(double d) {
System.out.println("m1(double)in Sub");
}
}
m1()in Super
m1(int)in Sub
m1(double)in Sub
13.(修饰符综合)
D F
1.
public static void main(String[] args) {
IA ia=new MyClasst();
ia.m1();
System.out.println(IA.a);
}
}
interface IA{
void m1();
int a=100;
}
class MyClasst implements IA{
public void m1() {}
}
100
2.
abstract
public void m2()