JAVA基础实验

JAVA基础实验

ID:37845091

大小:451.00 KB

页数:24页

时间:2019-06-01

JAVA基础实验_第1页
JAVA基础实验_第2页
JAVA基础实验_第3页
JAVA基础实验_第4页
JAVA基础实验_第5页
资源描述:

《JAVA基础实验》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、TheFirstExperiment—JavaprogrammingbasicQ1.Install,configureandtestJDK,thenoutput“helloworld”inthecommandwindow.Install,configureandtestJDKfollowthesteponthePPT.WriteasimpleJavasourcecode,compile,interpretandrunit.Typejavactest.javaincommandline.Typejavatestt

2、oseetheresult.ThisprocessiscalledasInterpretingandrunning.Q2.InstallanduseEclipsetooutput“helloworld”.Q3.OutputyourNameandStudentIDNumber.Thisexperimentjustneedmetomakealittlechangeonthesecondone.publicclasstestb{publicstaticvoidmain(String[]args){System.out

3、.println("王梦迪1341906103");}}Q4.InputfourintitemsnamedAge,Math,EnglishandHistoryfromyourkeyboard,giveapromptifanyitem’sinputisnotcorrect.ThatmademeknowsomethingabouttheoperationofoutputinJava.packagejava_input;importjava.util.Scanner;publicclassScannerTest{pu

4、blicstaticvoidmain(String[]args){Scannersc=newScanner(System.in);System.out.println("请输入年龄、数学、英语和历史成绩:");intage=sc.nextInt();intmath=sc.nextInt();intenglish=sc.nextInt();inthistory=sc.nextInt();sc.close();System.out.println("年龄:"+age);System.out.println("数学:

5、"+math);System.out.println("英语:"+english);System.out.println("历史:"+history);}}packagejava_input;importjava.util.InputMismatchException;importjava.util.Scanner;publicclassScannerException{publicstaticvoidmain(String[]args){Scannersc=newScanner(System.in);doub

6、le[]A=newdouble[5];for(inti=0;i

7、++产生的下标移位}}sc.close();for(doublei:A)System.out.println(i+"");}}Fig.4.1Fig.4.2Q5.ReadArraysUtil.javacarefully,addthepropercommentsintheprogram,andfinallyanalyzetheresultwithyourownwords.Ihavelearnedsomeoperationsonarray.packagejava_ArraysUtil;importjava.util.

8、Arrays;importjava.util.Scanner;publicclassArraysUtil{publicstaticvoidmain(String[]args){double[]X=newdouble[5];System.out.println("pleaseinputthenumbers:");Scannersc=newScanner(System.in);for(in

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

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

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