




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、1、閱讀以下程序,輸出結(jié)果為 。class Q1public static void main(String args )double d=1.23;Dec dec=new Dec( );dec.decrement(d);System.out.println(d);classs Decpublic void decrement(double decMe)decMe = decMe 0.1;2、以下程序段的輸出結(jié)果為 。class Cruncher void crunch( int i ) System.out.println(“int version”); void crunch(String
2、 s) System.out.println(“String version”); public static void main(String args ) Crunchercrun=new Cruncher ( ); char ch=p; crun.crunch(ch); 3、閱讀以下程序段:class Parentvoid printMe()System.out.println(“pt”);class Child extends Parentvoid printMe()System.out.print (“cd”);void printAll()super.printMe();this.
3、printMe();printMe();public class Test_thispublic static void main(String args )Child myC=new Child();myC.printAll();輸出結(jié)果為 。4、已有Bird類的定義如下:package abcde;public class Bird protected static int referenceCount=0; public Bird() referenceCount+; protected void fly() static int getReCount() return referenc
4、eCount; 有類Nightingale的定義如下,請寫出它的輸出結(jié)果 。package singers;class Nightingale extends abcde.Bird Nightingale( ) referenceCount+;public static void main( String args ) System.out.print(“Before:”+referenceCount); Nightingale florence=new Nightingale( ); System.out.println(“ After:”+referenceCount); florence
5、.fly( );5、以下程序段的輸出結(jié)果為 。public class testpublic static void main(String args ) StringBuffer s = new StringBuffer("Hello"); s.append("there"); System.out.println(s); String pf = s.substring(0, s.length(); System.out.println(pf.equals("Hellothere"); 6、以下程序段的輸出結(jié)果為 。class Pe
6、rson public Person() System.out.println("hi!"); public Person(String s) this(); System.out.println("I am "+s); public class Who extends Person public Who() this("I am Tony"); public Who(String s) super(s); System.out.println("How do you do?"); public static vo
7、id main(String args) Who w = new Who("Tom"); 7下面是一個類的定義。class _ / 定義名為MyClass的類 _ int var=666; static int getvar() return var; 8以下程序的輸出結(jié)果為 。public class abc public static void main(String args ) SubSubClass x = new SubSubClass(10 , 20 , 30); x.show(); class SuperClass int a,b; SuperClass(i
8、nt aa , int bb) a=aa; b=bb; void show( ) System.out.println("a="+a+"nb="+b); class SubClass extends SuperClass int c; SubClass(int aa,int bb,int cc) super(aa,bb); c=cc; class SubSubClass extends SubClass int a; SubSubClass(int aa,int bb,int cc) super(aa,bb,cc);a=aa+bb+cc; void sh
9、ow() System.out.println("a="+a+"nb="+b+"nc="+c); 9以下程序的輸出結(jié)果為 。class Person public Person() System.out.println("Person"); class Student extends Person publid Student() System.out.println("Student"); class CollegeStudent extends Student public CollegeS
10、tudent() System.out.println("CollegeStudent"); public class Test public static void main(String args) CollegeStudent cs=new CollegeStudent(); 10通過鍵盤輸入10個整數(shù),并按輸入的倒序輸出這10個整數(shù)。import java.io.*;public class Reverse public static void main(String args) int i,n=10; int a=new int10; for (i=0;i<
11、n;i+) try BufferedReader br=new BufferedReader( ); ai=Integer.parseInt( ); /輸入一個整數(shù) catch(IOException e); for(i=n-1;i>=0;i-) System.out.print(ai+" "); System.out.println(); 11以下程序的輸出結(jié)果為 。public class EqualOrNot public static void main(String args) B b1=new B(5); B b2=new B(5); System.out
12、.println(b1=b2); System.out.println(b1.equals(b2); class B int x; B(int y) x=y; 12以下程序的輸出結(jié)果為 。class Parent void printMe() System.out.println("parent"); class Child extends Parent void printMe() System.out.println("child"); void printAll() super.printMe(); this.printMe(); printMe(
13、); bpublic class Test_this public static void main(String args) Child myC=new Child(); myC.printAll(); 13以下程序的輸出結(jié)果為 。class Crunchervoid crunch( int
14、 i ) System.out.print(“int”); void crunch(String s) System.out.print(“String”); public static void main(String args )Cruncher crun=new Cruncher
15、160;( );char ch=h;int i=12;crun.crunch(ch); System.out.print(“,”);crun.crunch(i); 14閱讀以下程序:import java.io.*;public class AboutFile public static void main(
16、String args) BufferedReader b=new BufferedReader (new InputStreamReader(System.in); String s; System.out.flush();
17、0; try s=b.readLine(); System.out.println(“String is:”+s); Catch(IOException e) System.out.println(e.getMessage(); 運(yùn)行以上程序,若從鍵盤輸入: java<回車>則輸出結(jié)果為 。15寫出以下程序的運(yùn)行結(jié)果。public
18、 class TryCatchFinally static void Proc( int sel ) try if( sel=0 )System.out.println("
19、;no Exception "); return; else if( sel=1 ) int i=0; int j=4/i;
20、0; catch( ArithmeticException e ) System.out.println("Catch "); catch( Exception e ) System.out.p
21、rintln("Will not be executed"); finally System.out.println("finally"); public static void main( String args ) Proc( 0 ); Proc( 1 ); 輸出結(jié)果為: 。15閱讀以下程序,寫出輸出結(jié)果。class Animal Animal() System.out.print ("Animal
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年農(nóng)村電商示范縣創(chuàng)建資金申請政策環(huán)境與區(qū)域產(chǎn)業(yè)轉(zhuǎn)型升級報告
- 餐飲業(yè)供應(yīng)鏈整合與成本控制風(fēng)險預(yù)警研究報告
- 2025年教育信息化基礎(chǔ)設(shè)施建設(shè)與教育信息化產(chǎn)業(yè)政策研究報告
- 2025年數(shù)字藝術(shù)作品版權(quán)保護(hù)與知識產(chǎn)權(quán)保護(hù)策略報告
- 2025年長租公寓行業(yè)市場前景與盈利模式分析報告
- 2025年新能源汽車關(guān)鍵技術(shù)研發(fā)資金申請及市場前景分析報告
- 安全護(hù)理試題集及答案
- 2025年綠色建筑認(rèn)證體系在綠色酒店綠色建筑評價標(biāo)準(zhǔn)制定中的應(yīng)用與實(shí)踐報告001
- 金融領(lǐng)域AI倫理問題與監(jiān)管政策創(chuàng)新研究報告
- 2025年能源互聯(lián)網(wǎng)分布式能源交易機(jī)制與能源互聯(lián)網(wǎng)市場潛力分析報告
- 2025年上海市中考數(shù)學(xué)試卷附答案
- 關(guān)于七一活動方案
- 關(guān)于衛(wèi)生院“十五五”發(fā)展規(guī)劃(完整本)
- 福州市重點(diǎn)中學(xué)2025屆英語七下期末聯(lián)考試題含答案
- 2025年初中學(xué)業(yè)水平考試地理試卷(附答案)
- 大型醫(yī)院巡查醫(yī)院自查表
- 2025山西晉城市國有資本投資運(yùn)營有限公司部分子公司招聘11人筆試參考題庫附帶答案詳解析集合
- 期末專項復(fù)習(xí):課內(nèi)閱讀(附答案)-部編版四年級語文下冊
- 2024-2025 學(xué)年八年級英語下學(xué)期期末模擬卷 (揚(yáng)州專用)解析卷
- 2024年天津市南開區(qū)初中學(xué)業(yè)考查模擬地理試卷
- 第四屆福建省水產(chǎn)技術(shù)推廣職業(yè)技能競賽-水生物病害防治員備賽題庫(含答案)
評論
0/150
提交評論