What’s the output of&n...
发布于 2022-03-03 17:31:15
What’s the output of following code?(单选)
class A {
public void one() { System.out.println("one") }
private void two() { System.out.println("two") }
static void three() { System.out.println("three") }
protected void four() { System.out.println("four") }
public void test() {
this.one()
this.two()
this.three()
this.four()
}
}
class B extends A {
public void one() { System.out.println("Bone") }
private void two() { System.out.println("Btwo") }
static void three() { System.out.println("Bthree") }
protected void four() { System.out.println("Bfour") }
}
public class Test {
public static void main (String[] args) {
B b = new B()
b.test()
b.three()
}
}
class A {
public void one() { System.out.println("one") }
private void two() { System.out.println("two") }
static void three() { System.out.println("three") }
protected void four() { System.out.println("four") }
public void test() {
this.one()
this.two()
this.three()
this.four()
}
}
class B extends A {
public void one() { System.out.println("Bone") }
private void two() { System.out.println("Btwo") }
static void three() { System.out.println("Bthree") }
protected void four() { System.out.println("Bfour") }
}
public class Test {
public static void main (String[] args) {
B b = new B()
b.test()
b.three()
}
}
登录后免费查看答案
关注者
0
被浏览
38