一、单项选择题
1.关于继承以下陈述正确的是( D )
A. "X extends Y" is correct if and only if X is a class and Y is an interface.
B. "X extends Y" is correct if and only if X is an interface and Y is a class.
C. "X extends Y" is correct for all combinations of X and Y being classes and/or
interfaces.
D. "X extends Y" is correct if X and Y are either both classes or both interfaces.
2.运行第一行和第二行代码后,x、a、b的值正确的是( C )
1. int x, a=6,b=7;
2. x=a++ + b++;
A. x=15,a=7,b=8
B. x=15,a=6,b=7
C. x=13,a=7,b=8
D. x=13,a=6,b=7
3.表达式(13+3*4)/4%3的值是 ( A )
A. 0
B. 25
C. 2
D. 1
4.在JAVA程序中import、class和package的正确出现顺序是 ( C )
A. class,import,package
B. package,class,import
C. package,import,class
D. import,package,class
5.某一程序的main方法中有如下语句,则输出的结果是 ( B )
string s1=“0.5”,s2=“12”;
double x = Double.parseDouble(s1);
int y = Integer.parseInt(s2);
System.out.println(x+y);
A. 12
B. 12.5
C. 120.5
D. “12.5”
6.定义整数数组x:
int[] x=new int[25];
关于x的描述正确的是 ( D )
A. x[24] is undefined.
B. x[25] is 0
C. x[0] is null
D. x.length is 25
7.下列不属于面向对象编程的三个特征的是(B )
A.封装
B.指针操作
C.多态性
D.继承