[问题]
对于下列代码:
  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) }
  第10行语句将调用哪行语句?

(难度系数:2)
[选择答案]
A. line 2
B. line 3
C. line 6
D. line 7
[正确答案]
D
[问题]
类Teacher和Student是类Person的子类;
   Person p;
   Teacher t;
   Student s;
   //p, t and s are all non-null.
   if(t instanceof Person) { s = (Student)t; }
  最后一句语句的结果是:

(难度系数:2)
[选择答案]
A. 将构造一个Student对象;
B. 表达式是合法的;
C. 表达式是错误的;
D. 编译时正确,但运行时错误。
[正确答案]
B
[问题]
.给出下面代码:
  1) class Parent {
  2} private String name;
  3} public Parent(){}
  4} }
  5) public class Child extends Parent {
  6} private String department;
  7} public Child() {}
  8} public String getValue(){ return name; }
  9} public static void main(String arg[]) {
  10} Parent p = new Parent();
  11} }
  12} }
  那些行将引起错误?

(难度系数:2)
[选择答案]
A. 第3行
B. 第6行
C. 第7行
D. 第8行
[正确答案]
D
[问题]
MAX_LENGTH是int型public成员变量, 变量值保持为常量100,用简短语句定义这个变量。

(难度系数:2)
[选择答案]
A. public int MAX_LENGTH=100;
B. final int MAX_LENGTH=100;
C. final public int MAX_LENGTH=100;
D. public final int MAX_LENGTH=100.
[正确答案]
D
[问题]
下列代码哪几行会出错
1) public void modify() {
2) int I, j, k;
3) I = 100;
4) while ( I > 0 ) {
5) j = I * 2;
6) System.out.println (" The value of j is " + j );
7) k = k + 1;
8) I--;
9) }
10} }

(难度系数:2)
[选择答案]
A. line 4
B. line 6
C. line 7
D. line 8
[正确答案]
C
9312344: