Java选择题
(11) 下列哪个类是山编译器自动生成对象的特殊类,是用于类操作? B
A) System 类 B) Class 类 C) Thread 类 D) Object类 (12)
在Java源文件中什么类最多只能有一个,其他类的个数不限?A) public B) private C) protected D) 没有这种类 (13)
H列哪个选项是short型数据的取值范围? B
A ) -128 ?+127 B) -32768?+32767
C) -2147483648- +2417483647 D) -3.40282347E38 ?+3.40282347E38 (14)
下列哪项是将一个十六进制值赋值给一个long型变量? D
A) long number = 123L; B) long number = 0123; C) long number = 0123L; D) long number = 0x123L; (15)
下列程序段执行后的输出结果为B
int x=3; int y=10; System.out.println (y%x); A) 0 B) 1
A
C) 2 D) 3
(16) 下列的哪个程序段可能导致错误? B A) String s = \
String t = \String k = s + t; B) String s = \
String t; t = s [3] + uone\C) String s = ” hello”;
String stan da rd = s.toUpperCase (); D) String s = \
String t = s + \
(17) 在下列程序的划线处应填入的语句是D class Person {
private int a; }
public class Man exte nds Pers on {
public int b;
public static void main (String arg []) {
Pers on p = new Pers on (); Man t = new Man (); int i;
A) i = w; B) i = b; C) i = p.a; D) i = t.b; (18)
有如下程序段D
if (x>0) { System.out.println (\
else if (x>-4) { System.out.println (\else { System.out.println (\
x的取值在什么范围内时,将打印出字符串”second”? A) x > 0 B) x>-4 C) x<= -4
D) x <= 0&&x>?4 (19)
H列程序的输出结果是C
public class fff {
void printValue (int m) {
do { System.out.println (叮he value is\while ( -m > 10 ) }
public static void main (String arg []) { int i=10;
Test t= new Test (); t.printValue (i);