freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

java課堂練習題(參考版)

2024-08-05 19:06本頁面
  

【正文】 new ThreeTimeThread(third).start()。 } } public static void main(String args[]) throws Exception { new ThreeTimeThread(first).start()。 }catch (Exception e) {} String dateString = (currentTime)。 Date currentTime = new Date()。at39。 class ThreeTimeThread extends Thread{ public ThreeTimeThread(String str){ super(str)。 import .*。 } public void paint(Graphics g){ (s,25,25)。 public class HelloWorld extends Applet{ String s。 } } import 。 } } 答案: 1. Myclass, int j 2. a, i= 3. 0, args[i] 4. void, new 5. float, sum 編程題 : 編寫一個輸出 Hello World! 的程序,用兩種方式實現(xiàn)( Application、Applet)。 i++ ) sum+= a[i]。 for ( int i = 0 。 j 。 float sum=。 public class SumArray extends Applet { float[] a。 import 。 public ________ init( ) { a=new A( ); b=_____ B( )。 } } myprogram的定義 , 其中 A、 B 是該主類所在源程序中已定義的另兩個類的類名 : import java awt.*; import java applet.*; public class myprogram extends Applet//定義小程序的主類 { A a。 i++) (___________)。 public class MyClass { public static void main(String args[ ]) { if( !=___) for(int i=0。 } Java Application 的主類的定義,其功能是輸出所有命令行參數(shù)。 public void paint(Graphics ____ ) { int i=689。 y=j。 } } 問題: 如果將方法 Sort( )中的一對注釋符( /* */)去掉,程序輸出的結(jié)果是什么 ? 程序填空 : public class ____________ { int x, y。 i++) ( +b[i])。 */ } } public static void ShowArray(int b[]) { for(int i=0。 } /* if(i==1||i==2) ShowArray(x)。 x[j]=x[j+1]。 j。 i。 } public static void Sort(int[] x) { int w。 (排序后的數(shù)據(jù)序列 :)。 ShowArray(a)。 public class Test56_Sort { public static void main(String args[ ]) { int[] a={42,99,5,63,95,36,2,69,200,96}。 } 問題 : 當語句 m=fibonacci(3)。 fibonacci(n)=fibonacci(n1)+fibonacci(n2), n≥2; 設(shè) m 是 long 型變量 ,下面是用遞歸算法求菲波那契數(shù)列的方法 : long fibonacci(long n) { if(n==0||n==1) return n。 ( +s1+ +s2,40,70)。 s2=r2。 } B( char c, float r1, float r2) { super(c)。 B(float r1,float r2){ s1=r1。 } void Print(Graphics g) { ( +n+ +ch,20,70)。 } A( char c){ this( )。 char ch。 (g)。, , )。 public void init( ) { b=new B( 39。 import .*。b39。a39。b39。w39。c39。 問題 : 1)若執(zhí)行前 ch1 的值為 ?a39。 )。 } else ( ch1!=\39。b\39。a\39。 ) { if ( ch2 == ?b39。 (str2)。 String str2=Hello, students! 。 能寫為 s +=x[i]。 ( + s, 30, 60)。 i 。 public void paint(Graphics g) { int s=0。 import .*。} } 問題: 1)類 B 是否能繼承類 A 的屬性 x? 2)若 b 是類 B 的對象,則 ()的返回值是什么? 3)若 b 是類 B 的對象,則 ()的返回值是什么? 4)類 A 和類 B 都定義了 x 屬性,這種現(xiàn)象稱為什么? 閱讀程序 (或程序片段 )并回答問題 。} } class B extends A { int x=100。 問題: 1), 的值各是什么? 2), 的值各是什么? 現(xiàn)有類說明如下: class A { int x=10。 s1=new student(張三 ,20,33)。 score=a2。 student(String a1,int a2,int a3) {name=a1。 int age。 ( ++c1 == c2為 + ( ++c1 == c2 ), 25, 105 )。 ( b1 和 b2相或的結(jié)果是: + ( b1 | b2 ), 25, 45 )。 ( b1 和 b2相與的結(jié)果是: + ( b1 amp。 b1 = false。 c1 = 5。 public class Applet1 extends Applet { public void paint( Graphics g ) { int c1, c2。 } 問題 : 1)若執(zhí)行前 x=6, y=8,該程序段輸出是什么 ? 2)若執(zhí)行前 x=1, y=8,該程序段 輸出是什么 ? import 。 else { if ( y 5 ) ( two )。 (Class B: +\ta=+a +\td=+d+\tb=+b)。 void show( ){ (Class A: +\ta=+ +\td=+)。 String d=Java program.。 void show( ){ (Class A: +\ta=+a +\td=+d)。 } } // public class A{ int a=1。 ( )。 aa=new A( )。 ( )錯, Java 只能單繼承 簡 答題: 閱讀程序 ,回答以下問題 、 public class InheritTest1{ public static void main (String[] args){ A aa。 ( )對 4. 一個類的定義包括定義類頭和定義類體兩個部分。 的長度是 5。 ( )對 \39。 } } 如果要用最簡捷的一行代碼實現(xiàn) //和上面一個參數(shù)的 … 注釋所指出的功能,請寫出你認為最合適的一行代碼: this(a) 如果有一個類 MyFrame 是 Frame 的子類,能夠被不同包中的類所使用,同時又能夠為線程提供運行代碼( run()方法),請寫出該類的聲明頭。 public Example(int a){ …… .. x = a。 Object 請?zhí)畛鲈? 包中與下列基本數(shù)據(jù)類型相對應(yīng)的封裝類: float:, char: , boolean: 。其中 ________________的限定的范圍最大。 MyClass obj=new MyClass()。 答案: ABD 填空題 包 包含了 Collection 的接口和類的 API。 C、 當創(chuàng)建一個新線程時。 } } A、 in the Inner outer B、 outer C、 in the Inner D、 編譯不通過 答案: B 多選: 哪個布局管理器使用的是組件的最佳尺寸( preferred size) ( ) A、 FlowLayout B、 BorderLayout C、 GridLayout D、 CardLayout E、 GridBagLayout 答案: A 和 E 下面哪個方法可以在任何時候被任何線程調(diào)用 ?( ) A、 notify() B、 wait() C、 notifyAll() D、 sleep() E、 yield() F、 synchronized(this) 答案: DEF 定義一個類名為 的類,并且該類可被一個工程中的所有類訪問,那么該類的正確聲明應(yīng)為: ( ) A、 private class MyClass extends Object B、 class MyClass extends Object C、 public class MyClass D、 public class MyClass extends Object 答案: CD 下列哪些情況可以終止當前線程的運行 ?( ) A、 拋出一個例外時。 (123,123)。 class Inner{ void methodInner(){ (in the Inner)。 void foo(double d,final float f){ String s。 ()。 答案: D 1 運行下列程序 , 會產(chǎn)生什么結(jié)果 ?( ) public class X extends Thread implements Runable{ public void run(){ (this is run())。 C、 Thread 類屬于 。 } } 以上程序運行結(jié)果是: ( ) A、 Aclass Aclass B、 Bclass Bcl
點擊復制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1