欢迎来到天天文库
浏览记录
ID:13006971
大小:82.00 KB
页数:56页
时间:2018-07-20
《java面向对象程序设计试题一答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Java面向对象程序设计试题一答案一、单项选择题:选择第1题:B选择第2题:A选择第3题:C选择第4题:B选择第5题:A选择第6题:A选择第7题:B选择第8题:C选择第9题:B选择第10题:B二、多项选择题多项选择第1题:AB多项选择第2题:BD多项选择第3题:AD多项选择第4题:AD多项选择第5题:BCD多项选择第6题:AB多项选择第7题:ABCD多项选择第8题:ABCD多项选择第9题:BC多项选择第10题:BC三、填空题答案填空第1题:x=10,a=3,b=4,c=5填空第2题:java.util填
2、空第3题:(public)(static)(void)(main)(Stringargs[])填空第4题:1填空第5题:26 四、编程题答案1 publicclassHelloWorld { publicstaticvoidmain(Stringargs[]) { System.out.println("Hello,World!"); } } importjava.awt.Graphics; importjava.applet.Applet; publicclassHelloWorldex
3、tendsApplet{ Strings; publicvoidinit(){ s="HelloWorld!"; } publicvoidpaint(Graphicsg){ g.drawString(s,25,25); }}2 classyanghui { publicstaticvoidmain(Stringargs[]) { inti,j; intyhlevel=10; intyanghui[][]; System.out.println("杨晖三角形:"); yanghui=new
4、int[yhlevel][]; for(i=0;i5、.length-1]=1; } for(i=0;i6、ava.io.*; publicclassMemoController{ FileOutputStreamfos; OutputStreamWriterosw; BufferedWriterbw; publicMemoController(){ try{ fos=newFileOutputStream("memo.txt",true); osw=newOutputStreamWriter(fos); bw=newBufferedWriter(osw); }catch(Fi7、leNotFoundExceptione){}; } publicsynchronizedvoidappend(Strings){ try{ bw.write(s,0,s.length()); bw.flush(); bw.close(); osw.close(); fos.close(); }catch(IOExceptione){} } publicstaticvoidmain(Stringargs[]){ MemoControllermmc=newMem8、oController(); mmc.append("Iamxubin"); } }4 importjava.io.*; classPhones { staticFileOutputStreamfos; publicstaticfinalintlineLength=81; publicstaticvoidmain(Stringargs[])throwsIOException { byte[]phone=newbyte[lin
5、.length-1]=1; } for(i=0;i6、ava.io.*; publicclassMemoController{ FileOutputStreamfos; OutputStreamWriterosw; BufferedWriterbw; publicMemoController(){ try{ fos=newFileOutputStream("memo.txt",true); osw=newOutputStreamWriter(fos); bw=newBufferedWriter(osw); }catch(Fi7、leNotFoundExceptione){}; } publicsynchronizedvoidappend(Strings){ try{ bw.write(s,0,s.length()); bw.flush(); bw.close(); osw.close(); fos.close(); }catch(IOExceptione){} } publicstaticvoidmain(Stringargs[]){ MemoControllermmc=newMem8、oController(); mmc.append("Iamxubin"); } }4 importjava.io.*; classPhones { staticFileOutputStreamfos; publicstaticfinalintlineLength=81; publicstaticvoidmain(Stringargs[])throwsIOException { byte[]phone=newbyte[lin
6、ava.io.*; publicclassMemoController{ FileOutputStreamfos; OutputStreamWriterosw; BufferedWriterbw; publicMemoController(){ try{ fos=newFileOutputStream("memo.txt",true); osw=newOutputStreamWriter(fos); bw=newBufferedWriter(osw); }catch(Fi
7、leNotFoundExceptione){}; } publicsynchronizedvoidappend(Strings){ try{ bw.write(s,0,s.length()); bw.flush(); bw.close(); osw.close(); fos.close(); }catch(IOExceptione){} } publicstaticvoidmain(Stringargs[]){ MemoControllermmc=newMem
8、oController(); mmc.append("Iamxubin"); } }4 importjava.io.*; classPhones { staticFileOutputStreamfos; publicstaticfinalintlineLength=81; publicstaticvoidmain(Stringargs[])throwsIOException { byte[]phone=newbyte[lin
此文档下载收益归作者所有