class Person { 2) public void printValue()
A.on?line?2
B.on?line?3
C.on?line?6
D.on?line?7
A.on?line?2
B.on?line?3
C.on?line?6
D.on?line?7
第1题
Given the following code:
1)class Person {
2) public void printValue(int i, int j) {/*…*/ }
3) public void printValue(int i) {/*…*/
4) }
5) public class Teacher extends Person {
6) public void printValue() {/*…*/ }
7) public void printValue(int i) {/*…*/}
8) public static void main(String args[]) {
9) Person t = new Teacher();
10) t.printValue(10) ;
11)}
12)}
Which method will the statement on line 10 call?
A.on line 2 B.on line 3
C.on line 6 D.on line 7
第2题
对于下列代码: 1) class Person { 2) public void printValue(inti, int j) {..、} 3) public void printValue(int i){..、} 4) }5) public class Teacher extends Person { 6) public voidprintValue() {..、} 7) public void printValue(int i) {...}8) public static void main(String args[]){ 9) Person t = newTeacher(); 10) t.printValue(10); 11) } 第10行语句将调用哪行语句?()。
A、line 2
B、line 3
C、line 6
D、line 7
第3题
有以下程序:
1)class Person {
2)public void printValue(inti, int j) {/*…*/ }
3)public void printValue(int i){/*…*/}
4)}
5)public class Teacher extends Person{
6)public void printValue() {/*…*/}
7)public void printValue(int i){/*…*/}
8)public static void main(String args[]){
9)Persorn t=new Teacher();
10)t.printValue(10);
11)}
12)}
第10行的声明将调用的方法______。
A.on line 2 B.on line 3 C.on line 6 D.on line 7
第4题
给出下面的代码:
class Person{
String name,department ;
public void printValue(){
System.out.println("name is"+name);
System.out.println("department is "+department);
}
}
public class Teacher extends Person{
int salary;
public void printValue(){
//doing the same as in the parent method printValue()
//including print the value of name and department.
System.out.printin("salary is"+salary);
}
}
下面的______表达式可以加入printValue()方法的”doing the same as…”部分.
A.printValue(); B.this.printValue();
C.person.printValue();D.super.printValue();
第8题
下列程序的输出结果是public class fff { void printValue (int m) { do { System.out.println("The value is" +m); } while(--m>10) } public static void main (String arg[]) { int i=10; Test t= new Test(); t. printValue(i); }}
A.8
B.9
C.10
D.11
第9题
Given the following code:
public class Test {
void printValue(int m) {
do { System.out.println("The value is"+m);
}
while(--m >10 )
}
public static void main(String arg[]) {
int i=10;
Test t= new Test ();
t.printValue(i) ;
}
}
Which will be output?
A.The value is 8 B.The value is 9
C.The value is 10 D.The value is 11
为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!