欢迎来到天天文库
浏览记录
ID:10916940
大小:49.00 KB
页数:4页
时间:2018-07-08
《java编程题目及答案》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、1.从键盘输入10个整数,存储到一个数组中,然后找出其中最大值和最小值,并给出他们在数组中的下标。importjava.io.BufferedReader;importjava.io.InputStreamReader;importjava.io.IOException;publicclassjfa{publicstaticvoidmain(String[]args){intNumbers[]=newint[10];BufferedReaderr=newBufferedReader(newInputStreamRead
2、er(System.in));try{for(inti=0;iMax){Max=Numbers[i];MaxSubscript
3、=i;}if(Numbers[i]4、出“你好”的Applet和Application程序)importjava.awt.*;importjava.applet.*;publicclassc1_1extendsApplet{publicvoidpaint(Graphicsg){g.drawString(“你好”,25,25);}}publicclassc1_2{publicstaticvoidmain(Stringargs[]){System.out.println(“你好”);}}3.计算圆的面积(Applet和Application)importjav5、a.awt.*;importjava.applet.*;publicclassc2_1extendsApplet{doublecparea(doubler){returnMath.PI*r*r;}publicvoidpaint(Graphicsg){doubleb=12;g.drawString("面积是:"+cparea(b),25,25);}}publicclassc2_2{staticdoublecparea(doubler){returnMath.PI*r*r;}publicstaticvoidmain(Str6、ingargs[]){doubleb=12;System.out.println("面积是:"+cparea(b));}}importjava.io.BufferedReader;importjava.io.InputStreamReader;importjava.io.IOException;publicclassc2_2{staticdoublecparea(doubler){returnMath.PI*r*r;}publicstaticvoidmain(Stringargs[])throwsIOException7、{BufferedReaderx=newBufferedReader(newInputStreamReader(System.in));System.out.println("面积是:"+cparea(Double.parseDouble(x.readLine())));}}1.设定5个字符串并只打印那些以字母“b”开头的串。P1657.5publicclassj7_5{publicstaticvoidmain(Stringargs[]){Strings[]=newString[5];s[0]="GHASFDSGSER8、GFFHGFb";s[1]="bdfGDFDFGfdgdfgfd";s[2]="SAFSA$%#%#$";s[3]="abaaaaaaaasdad";s[4]="btgsgtetesrhyrsyr";for(inti=0;i
4、出“你好”的Applet和Application程序)importjava.awt.*;importjava.applet.*;publicclassc1_1extendsApplet{publicvoidpaint(Graphicsg){g.drawString(“你好”,25,25);}}publicclassc1_2{publicstaticvoidmain(Stringargs[]){System.out.println(“你好”);}}3.计算圆的面积(Applet和Application)importjav
5、a.awt.*;importjava.applet.*;publicclassc2_1extendsApplet{doublecparea(doubler){returnMath.PI*r*r;}publicvoidpaint(Graphicsg){doubleb=12;g.drawString("面积是:"+cparea(b),25,25);}}publicclassc2_2{staticdoublecparea(doubler){returnMath.PI*r*r;}publicstaticvoidmain(Str
6、ingargs[]){doubleb=12;System.out.println("面积是:"+cparea(b));}}importjava.io.BufferedReader;importjava.io.InputStreamReader;importjava.io.IOException;publicclassc2_2{staticdoublecparea(doubler){returnMath.PI*r*r;}publicstaticvoidmain(Stringargs[])throwsIOException
7、{BufferedReaderx=newBufferedReader(newInputStreamReader(System.in));System.out.println("面积是:"+cparea(Double.parseDouble(x.readLine())));}}1.设定5个字符串并只打印那些以字母“b”开头的串。P1657.5publicclassj7_5{publicstaticvoidmain(Stringargs[]){Strings[]=newString[5];s[0]="GHASFDSGSER
8、GFFHGFb";s[1]="bdfGDFDFGfdgdfgfd";s[2]="SAFSA$%#%#$";s[3]="abaaaaaaaasdad";s[4]="btgsgtetesrhyrsyr";for(inti=0;i
此文档下载收益归作者所有