【正文】
ass C、 Aclass Bclass D、 Bclass Aclass 答案: C 1 下列關(guān)于 Java 線程的說法那些是正確的( ) A、 每一個(gè) Java 線程可以看成由代碼、一個(gè)真實(shí)的 CPU 以及數(shù)據(jù)三部份組成。 ()。 } public static void main(String args[]){ Aclass a=new Aclass()。如果在 A 區(qū)域使用某種 AWT 組件( 的子類)來負(fù)責(zé)繪制圖像 ,則繪圖 的語句最好應(yīng)放在該組件的哪個(gè)方法中 (考慮到應(yīng)用程序和 Java 虛擬機(jī)的 AWT 線程都會要求重畫該組件 )?( ) A、 構(gòu)造方法 B、 paint( Graphics g) C、 update( Graphics g) D、 repaint() 答案: B 1 下面關(guān)于 Applet 的說法正確的是 ( ) A、 Applet 也需要 main 方法 B、 Applet 必須繼承自 C、 Applet 能訪問本地文件 D、 Applet 程序不需要編譯 答案: B 1 看 下面一段程序: class Aclass{ void go(){ (Aclass)。 答案: A 容器被重新設(shè)置大小后,哪種布局管理器的容器中的組件大小不隨容器大小的變化而改變 ?( ) A、 CardLayout B、 FlowLayout C、 BorderLayout D、 GridLayout 答案: B 欲編寫如下圖的一個(gè)界面,用于顯示用戶指定的圖像 : 如果在區(qū)域 A 中只能放置一個(gè) AWT 組件,從各組件的本來功能角度考慮,最好使用哪種組件: ( ) A、 TextArea B、 Panel C、 Applet D、 Canvas 答案: D 界面如上題所示。 (9)。 int c=()。 int c=()。 B、 FileInputStream in=new FileInputStream()。 (9)。 ()。 } } A、 good and abc B、 good and gbc C、 test ok and abc D、 test ok and gbc 答案: B 運(yùn)行下列程序 , 會產(chǎn)生什么結(jié)果 ( ) public class X extends Thread implements Runable{ public void run(){ (this is run())。 ch[0]=39。 ()。 (,)。}。,39。,39。 char[]ch={39。若 Button1的功能是:點(diǎn)擊后彈出一個(gè)用于輸入的界面,獲取用戶想要顯示的圖像文件名,則該界面最好是(從編程簡單和程序不易出錯(cuò)的角度考慮) :( ) A、 模式( Modal) Dialog B、 非模式( Nonemodal) Dialog C、 FileDialog D、 Frame 答案: C 界面如上題所示。 //(“”)。 //Double 應(yīng)該小寫 B、 double a=。 } finally{ (Thank you!)。 } catch (ArrayIndexOutOfBoundsException e) { (Exception?)。 } A、 Test 1 B、 Test 2 C、 Test 3 D、 Test 4 答案: ACD 給定下面的代碼片段: public void Test() { try { method()。} finally{(Test 3)。 (Test1)。 答案: A 和 C 定義一個(gè)類名為 的類,并且該類可被一個(gè)工程中的所有類訪問,那么該類的正確聲明應(yīng)為: ( ) A、 private class MyClass extends Object B、 class MyClass extends Object C、 public class MyClass D、 public class MyClass extends Object 答案: C 和 D 指出下列哪個(gè)方法與方法 public void add(int a){}為合理的重載方法。(0)?():0。 int i=(s!=null)amp。 s=i+。//對 D、 String s=你好 。int i=3。 if(i==s){ s+=i}。//對 B、 String s=你好 。int i=3。 A) x( int m){ ... } B) void x( int m){ ... } C) x( int m, int n){ ... } D) x( int h,int m,int n){ ... } 答案: B 1 下面數(shù)據(jù)結(jié)構(gòu)中,屬于非線性的是 ( )。 } 答案: A 1 用于定義類成員的訪問控制權(quán)的一組關(guān)鍵字是 ( )。 } C) int x( ){ ...return true。 return (int)ch。 A) int x( ){ char ch=39。 D) x x1=x( )。 B) public x x1=new x(int 123)。 A) class x { .... } B) class x extends y { .... } C) static class x implements y1,y2 { .... } D) public class x extends Applet { .... } 答案: C 靜態(tài)類不能實(shí)現(xiàn)接口 設(shè) x、 y 為已定義的類名,下列聲明 x類的對象 x1 的語句中正確的是 ( )。 D) final char i。 C) final i=39。 A) static final int i=100。 A) interface B) package C) extends D) class 答案: C 定義類頭時(shí)能使用的修飾符是 ( )。 A) class x { .... } B) class x extends y { .... } C) static class x implements y1,y2 { .... } D) public class x extends Applet { .... } 答案: C Java 語言的類間的繼承關(guān)系是 ( )。 A) private B) static C) abstract D) protected 答案: C 定義類的的修飾符可以是抽象的,共有的或者是省略。k++){ (a[+k+]:+a[k])。 } } for (int k=0。 a[i]=a[j]。 j 。 i。 int temp。 import .*。 ()。jyanghui[i].length。 i。 yanghui[i][yanghui[i].length1]=1。jyanghui[i].length1。i++){ yanghui[i][0]=1。 for (i=1。i++) yanghui[i]=new int[i+1]。 for(i=0。 (楊暉三角形 :)。 int yhlevel=10。 max=xy?x:y min= xy?x:y 10 、 結(jié)構(gòu)化程序設(shè)計(jì)的三種基本流程控制結(jié)構(gòu)是: _____________ 、 _____________、 _____ _____。 public static void main(String[] args) 設(shè) x, y, max,min 均為 int 型變量, x、 y 已賦值。__________。 元素個(gè)數(shù) 執(zhí)行下列代碼后的結(jié)果是什么 ? int x,a=2,b=3,c=4。 new 當(dāng)整型變量 n 的值不能被 13 除盡時(shí),其值為 false 的 Java 語言表達(dá)式是_____________ 。 (沒有 ) Java 語言中的浮點(diǎn)型數(shù)據(jù)根據(jù)數(shù)據(jù)存儲長度和數(shù)值精度的不同,進(jìn)一步分為float 和 __________兩種具體類型。 答案: A 和 B 填空題: 若 a,b 為 int 型變量且已分別賦值為 2, 4。 i 5。 E、 String [] a = new String [5]。 C、 String a [5]。 a[i++] = )。 for (int i = 0。 C、 String s[][]=new String[2][]。//對 C、 s[0] 為 未定義 //錯(cuò),數(shù)組的下標(biāo)是從 0 開始的 D、 為 10//對 下列哪些語句是正確的 ?( ) A、 int a[][]=new int[][3]。( ) A、 s[10] 為 。 } } 那個(gè)語句是正確的? ( ) A、 編譯時(shí)將產(chǎn)生錯(cuò)誤; B、 編譯時(shí)正確,運(yùn)行時(shí)將產(chǎn)生錯(cuò)誤; C、 輸出零; D、 輸出空。 A) x[53] B) x[k] C) x[k+5] D) x[0] 答案: C ,下標(biāo)越界 給出下面代碼: public class Person{ static int arr[] = new int[10]。 A、 8 B、 20 C、 11 D、 9 答案 : B 數(shù)組的定義 若已定義 byte[ ] x= {11,22,33,66} 。 t4 = t1 t2 ? t1 : t2+ t1。 A) 0 B) 1 C) true D) false 答案: C() ?b1:b2 條件運(yùn)算符:如果括號內(nèi)的值為 true 則取 b1,反之取 b2 下列程序段執(zhí)行后 t5 的結(jié)果是 ( ) int t1 = 9, t2 = 11, t3=8。 boolean b1=true, b2=false, b3。 { ...... } { ...... } 答案: B 表達(dá)式的返回值必須是下述幾種類型之一: int, byte, char, short 1 不能構(gòu)成循環(huán)的語句是 ( )。 A) 有語法錯(cuò),不能執(zhí)行 B) 無限次 C) 執(zhí)行 1 次 D) 一次也不執(zhí)行 答案: B 1 設(shè) int 型變量 a、 b, float 型變量 x、 y, char 型變量 ch 均已正確定義并賦值, 正確的 switch 語句是 ( )。 true 。 A) 16 B) 8 C) 4 D) 2 答案: D 1 以下由 for 語句構(gòu)成的循 環(huán)執(zhí)行的次數(shù)是 ( )。 do { i/=2。 A) 4 B) 5 C) 6 D) 7 答案: B 1 下列語句