試題
指出下面語句沒有編譯錯誤的是( )
A
B
C
D
試題
完成代碼計算
long result =
for(int i =
< ? 填入代碼 ? >
}
System
… … …
A
B
C
D
試題
下列關於數組的聲明錯誤的是
A
B
C
D
試題
實現對數組arry的冒泡排序
public static void bubbleSort(int[] arry) {
int len = arry
for (int i =
boolean asc = true;
< ? 填入代碼 ? >
if (asc)? return;
}
}
private static void swap(int[] arry
int temp = arry[i];
arry[i] = arry[j];
arry[j] = temp;
}
A
for (int j = len
if (arry[j] < arry[j
swap(arry
asc = false;
}
}
B
for (int j = len
if (arry[j] < arry[j
swap(arry
asc = false;
}
}
C
for (int j = len
if (arry[j] > arry[j
swap(arry
asc = false;
}
}
D
for (int j = len
if (arry[j] < arry[j
swap(arry
asc = true;
}
}
試題
數列
下面的代碼用於求第
int n =
long n
for (int i =
< ? 填入代碼 ? >
}
System
A
B
C
D
試題
語句System
A
B
C
D
試題
下面程序的輸出結果是
public static void main(String[] args) {
int d =
int sum =
while (d >
int n = d %
sum += n;
d /=
}
System
}
A
B
C
D
試題
下面的程序沒有編譯錯誤的是
A
public class Main{
public static void main(String[] args) {
byte b
byte b
byte b = b
}
}
B
public class Main{
public static void main(String[] args) {
int n;
for(int i=
n +=i;
}
}
}
C
public class Main{
public static void main(String[] args) {
int n =
for(;;)? {
}
System
}
}
D
public class Main{
public static void main(String[] args) {
int n =
while(n>
System
}
}
試題
Java語言中int類型標示整數的最大范圍是
A
B
C
D
試題
Java語言中字符串
A
B
C
D
試題
下面的代碼使用二分法在有序的int類型數組arry查找元素key
否則輸出
public static void main(String[] args) {
int key =
int[] arry = {
int low =
int high = arry
while (low <= high) {
< ? 填入代碼 ? >
else {
System
return;
}
}
System
}
A
int mid = (low + high) >>>
if (arry[mid] > key)
low = mid +
else if (arry[mid] < key)
high = mid
B
int mid = (low + high) >>>
if (arry[mid] < key)
low = mid;
else if (arry[mid] > key)
high = mid
C
int mid = (low + high) >>>
if (arry[mid] < key)
low = mid +
else if (arry[mid] > key)
high = mid;
D
int mid = (low + high) >>>
if (arry[mid] < key)
low = mid +
else if (arry[mid] > key)
high = mid
試題
下面的代碼試圖從
其中random(int n)方法用於返回大於等於
public static void main(String[] args) {
int num =
char[] ch = {
int len = ch
char[] result = new char[num]; // 用於存放抽取結果
boolean[] flags = new boolean[len];
<? 填入代碼 >
for (int i =
System
}
}
public static int random(int n) {
Random r = new Random();
return r
}
A
for (int i =
int r;
do {
r = random(len);
} while (!flags[r]);
result[i] = ch[r];
flags[i] = false;
}
B
for (int i =
int r;
do {
r = random(len);
} while (!flags[r]);
result[i] = ch[r];
flags[r] = true;
}
C
for (int i =
int r;
do {
r = random(len);
} while (flags[r]);
result[i] = ch[r];
flags[r] = true;
}
D
for (int i =
int r;
do {
r = random(len);
} while (!flags[r]);
result[i] = ch[r];
flags[r] = true;
}
試題
對JDK描述錯誤的是? C
A
B
C
D
試題
對CLASSPATH描述正確的是 D
A
B
C
D
試題
下面代碼的輸出結果是? b
public class Main {
public static void main(String[] args) {
int n
int n
n
n
n
System
}
}
A
B
C
D
試題
下面代碼的輸出結果是 C
public class Main {
public static void main(String[] args) {
int n =
int m =
System
System
}
public static int f(int m
n = m+n;
return n;
}
}
A
B
C
D
試題
下面關於Java語言中方法的說法錯誤的是? :D
A
B
C
D
試題
下面不屬於Java語言特點的是
A
B
C
D
試題
下面代碼的輸出結果是? B
double money =
money
System
A
B
C
D
試題
關於數組的說法正確的是? D
A
B
C
D
From:http://tw.wingwit.com/Article/program/Java/JSP/201405/30950.html