java考试题带答案

java考试题带答案

ID:47595231

大小:142.50 KB

页数:13页

时间:2019-09-23

java考试题带答案_第1页
java考试题带答案_第2页
java考试题带答案_第3页
java考试题带答案_第4页
java考试题带答案_第5页
资源描述:

《java考试题带答案》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、第一章复习题1.4Sourceprogrammeanstheoriginalprogramwritteninahigh-levellanguage・Acompilerisaprogramthattranslatessourceprogramintoexecutablecode・1.7DevelopedbyateamledbyJamesGoslingatSunMicrosystemsin1991・OriginallycalledOak,itbecameJavain1995whenitwasredesignedfordevelopingInternetapplications.1.11

2、Keywordshavespec讦icmeaningtothecompilerandcannotbeusedforotherpurposesintheprogramsuchasvariablesormethodnames・Examplesofkeywordsareclass,static,andvoid.1.12Javasourcecodeiscasesensitive.Javakeywordsarealwaysinlowercase・1.13Thesourcefileextensionis.javaandthebytecodefileextensionis.class.1.16p

3、ublicclassWelcome{publicstaticvoidmein(String[]args){System.out•print丄n(HmorningH);System,out"afternoon");i1.17Line2.Mainshouldbemain.Line2.staticismissing.Line3:WelcometoJava!shouldbeenclosedinsidedoublequotationmarks・Line5:Thelast)shouldbe}.1.18javacistheJDKcommandtocompileaprogram,javaisthe

4、JDKcommandtorunaprogram.1.19Javainterpretercannotfindthe・classfile・Makesureyouplacedthe・classintherightplace,andinvokedjavacommandwithappropriatepackagename・1.20Theclassdoesnothaveamainmethod,orthesignatureofthemainmethodisincorrect.编程题1-6publicclassExercisel_6{publicstaticvoidmain(String[]arg

5、s){System.out.println(l+2+3+4+5+6+7+8+9);}}1-7publicclassExercisel_7{publicstaticvoidmain(String[]args){System.out.println(4*(1-1.0/3+1.0/5・1.0/7+1.0/9・1.0/11+1.0/13));}}第二章复习题2.1Valididentifiers:applet,Applet,$4,apps,x,y,radiusInvalididentifiers:a++,-a,4#R,#44,class,public,intKeywords:class,p

6、ublic,int2.14Line2:Missingstaticforthemainmethod.Line2:stringshouldbeString.Line3:iisdefinedbutnotinitializedbeforeitisusedinLine5.Line4:kisanint,cannotassignadoublevaluetok・Lines7-8:Thestringcannotbebrokenintotwolines.2.24bc-22.25System.out.println("l"+1);=>11System.out.printlnCl'+1);=>50(sin

7、cetheUnicodefor1is49System.out.println("l"+1+1);=>111System.out.println("l"+(1+1));=>12System.out.println('l'+1+1);=>51编程练习2.2importjava.util.Seanner;publicclassExercise2_2{publicstaticvoidmain(String[]args){Scannerinput=newScanner(Syst

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。