欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    Java复习题阅读程序题软件.docx

    • 资源ID:12260223       资源大小:19.10KB        全文页数:23页
    • 资源格式: DOCX        下载积分:8金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    Java复习题阅读程序题软件.docx

    1、Java复习题阅读程序题软件JAVA程序设计复习题之(三)阅读程序题三、程序阅读题1阅读以下程序import .*;public class Reverse2 public static void main(String args ) int i,n=10; int a = new int10; try BufferedReader br = new BufferedReader( new InputStreamReader); ai = () ); catch (IOException e) ; for (i= n-1; i = 0; i=i-2) ); 请写出该程序的功能:该程序使用字符缓

    2、冲输入流从键盘输入10个数,然后倒序并间隔打印出来。2阅读以下程序import .* ;public class abc public static void main(String args ) int i, s = 0 ; int a = 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120 ; for ( i = 0 ; i ; i+ ) if (i % 3 = 0) s += ai; s= + s); 请写出该程序的输出结果:s=2603、阅读以下程序:import .*;public class TestRandomAccess public s

    3、tatic void main(String args) int data_arr=65,66,56,23,27,1,43,65,4,99; try RandomAccessFile randf=new RandomAccessFile(,rw); for (int i=0; i=0; i=i-2) (i*4); System,( +(); (40); (); catch (IOException e) File access error: +e); 该程序的输出结果是:99 65 1 23 66 Good morning!4、阅读以下程序并填空。class _ extends Excepti

    4、on String mymsg=我自己定义的异常!; double mynum = ; MyException () super(首字母不能为A! ); MyException (String msg)_ harAt(O)= A) MyException e = new MyException();kkkk: + ();();Systemoutprintln(*in try*); _; harAt(O)= B) throw new MyException (第一个字符不应是B! ); else catch ( _ ) (); + (); catch( _ ) 命令行参数个数错!); 程序填空:

    5、MyException super(msg)throw eMyException aaaArrayIndexOutOfBoundsException5、阅读以下程序 import .*;public class Test public static void main(String args) SubSubClass m=new SubSubClass(3,6,6); (); class SuperClass int a,b; SuperClass(int x,int y) a=x; b=y; class SubClass extends SuperClass int c; SubClass(

    6、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 show() a=+ a +nb=+ b +nc=+ c); 请写出该程序的运行结果:a=60b=20c=306、阅读以下程序import .*;public class abc public static void main(String args) String sl = H

    7、ello!; String s2 = new String(World!); 请写出该程序的运行结果:Hello!World!7、阅读以下程序import .*;public class Class1 public static void main(String args) int i,max,min; int a = 12,67,8,98,23,56,124,55,99,100); max= min= a0; for(i=1; i; i+) if( ai max) max = ai; max + + min); 请写出该程序完成的功能:在数组中查找并输出最大值和最小值。8、阅读以下程序imp

    8、ort .*;import class DrawMylmage extends Applet Image myImage; ;import .*;import .*;public class Mypicture _ Applet Image image; public void _() try image=getlmage(new URL(getCodeBase(),); _(MalformedURLException e) public void paint(Graphics g) (image,0,0,_); public void start() _(); 程序填空题:extends i

    9、nit catch this repaint10、阅读以下程序:public class Sum public static void main( String args) double sum = ; for ( int i = 1; i= 100; i + ) sum += i;, sum= + sum ); 该程序完成的功能是:求sum=1+2+3+.+100的和。11、阅读以下程序:class SuperClass int a,b; SuperClass(int x,int y) a=x; b=y; voidshow() a=+ a + nb=+ b); class SubClass

    10、extends SuperClass int c; SubClass(int aa,int bb,int cc) super(aa,bb); c=cc; voidshow() c=+ c +na=+ a +nb=+ b); class SubSubClass extends SubClass int a; SubSubClass(int aa,int bb,int cc) super(aa,bb,cc); a=aa+bb+cc; void show() a=+ a +nb=+ b +nc=+ c); class test public static void main(String args)

    11、 SuperClass p=new SubSubClass(10,20,30); (); 该程序的输出结果是:a=60b=20c=3012、阅读以下程序:import .*;publiic class Test public static void main(String args) AB s = new AB(Hello!,I love Java.); () ); class AB String sl; String s2; AB( String strl, String str2 ) sl = str1; s2 = str2; public String toString() return

    12、 sl + s2; 该程序的输出结果是:Hello!I love Java.13、阅读以下程序,并填空。import _class MyCopy public static void main(Stringo args) int ch; FileInputStream fin; _ fout; try fin = new FileInputStream(args0); fout = new FileOutputStream(_); ch = (); while(ch!=-1) _ ch = (); (); (); catch (_ e1) 使用格式错误!正确格式为:java mycopy源文件

    13、名目标文件名); (0); catch (FileNotFoundException e3) 文件没有找到!); catch (IOException e2) 流错误!); 程序填空:import .*;FileOutputStreamargs0(ch);ArrayIndexOutOfBoundsException14、阅读以下程序import .*;public class Reverse public static void main(String args) int i,n=10; int a = new int10; for(i=0; in; i+) try BufferedReade

    14、r br= new BufferedReader( new InputStreamReader); ai=(); ;public class Test public static void main(String args ) int i, s = 0; int a = 10, 20, 30, 40, 50, 60, 70, 80, 90; for ( i = 0 ; i ; i+ ) if(ai % 3 = 0) s += ai; s= + s); 请写出此程序的输出结果:s=18016、阅读以下程序(提示:注意同步)class One synchronized void display(i

    15、nt num) two + num); try (1000); catch (InterruptedException e) 中断”); 完成”); class Two implements Runnable int number; One one; Thread t; public Two(One one_num, int n) one = one_num; number = n; t = new Thread(this); (); public void run() (number); public class Synch public static void main(String ar

    16、gs) throws InterruptedException One one = new One(); int digit = 100; Two s1 = new Two(one,digit); Two s2 = new Two(one,digit); Two s3 = new Two(one,digit); Two s4 = new Two(one,digit); Synch结束!); 此程序的输出结果是:two 100完成two 100完成two 100完成two 100完成Synch 结束!17、阅读以下程序,并填空。import _ ;class FileType public st

    17、atic void main(String args) _; try FileReader fis = new_(args0); BufferedReader reader = new BufferedReader( ); String s; while(s=()!=_) +(i+)+: + s); (); (); catch (IOException e) catch (_ e1) 缺少命令行参数!”); 程序填空:.*;int i;FileReaderfisnullArrayIndexOutOfBoundsException18、阅读以下程序:public class Sum public

    18、 static void main(String args) double sum = : for (int i=1; i=100; i+) sum += i*i; sum=+sum); 该程序的功能是:求出sum的值为1到100的平方和。19、阅读以下程序:class Example public static void main(String args) int a = new int33; a00=1; a11=1; a22=1; 数组a:); for (int i=0; i ; i+) for(int j=0; j ai.length; j+) + ); 该程序的输出结果是:1 0 0

    19、0 1 00 0 120、阅读以下程序:public class Test2 static boolean foo(char c) return true; public static void main(String args) int i = 0: for(foo(A); foo(B) & (i2); foo(C) i+; foo(D); 此程序的输出结果是:ABDCBDCB21、阅读以下程序,并填空。import _;import class OvalDrawer extends Frame implements Runnable private Color colors= , , ;

    20、private Color color; private int x=l0,y=10,width=10,height=10; public OvalDrawer(String title) super(title); _; ;setSize(300,300);new Thread(this).start();repaint();(x,y,width,height);22、阅读以下程序:public class Sum public static void main(String args) double sum = ; for (int i=1; i=100; i+) sum += / (do

    21、uble)i; sum=+sum); 此程序完成的功能是:求解sum=1+1/2+1/3+.+1/100的值并打印输出。23、阅读以下程序:import .*;import class Applet1 extends Applet public void paint(Graphics g) (30,5,100,45); (30,50,50,20); (30,80,50,40); (They are figures! ,30,150); 此程序完成的功能是:在Applet界面中显示一些由直线、矩形框、椭圆框和文字组成的图形。24、阅读以下程序:import .*;public class Tes

    22、t public static void main(String args) int i; int a=11,22,33,44,55,66,77,88,99; for(i=0; i = 2; i+) + a + ); 此程序的输出结果是:110 110 110 110 11025、阅读程序并填空import .*;import .*;public class DrawStringDemo _ Applet private Font afont = _Font(Helvetica,18); public void init() _; public void paint(Graphics g) ;

    23、 _(afont); _(This is a test,10,40); 程序填空:extends new setBackground setFont drawString26、阅读以下程序public class Test( public static void main(String args) sqrt=%f, ); 此程序的输出是:sqrt=27、阅读以下程序public class SumTest public static void main(String args) double sum = ; for(int i=1; i 0 ) y = 2 * x; else if( x =

    24、0) y = 2 + (x); else y = x * x + 1; y= + y); 此程序完成的功能是:从键盘输入一个数x,根据x的值求出相应的y值。 2*x x0y= 2 + cos(x) x=0 x2+1 x029、阅读以下程序,完成填空,使其完整。import _;class Rectangle public static void main(String args) _w,l,S,s; double()w*l(w+l)*230、阅读以下程序:public class Sum public static void main(String args) double sum = ; for(int i = 1; i = 100; i+) sum += i*i*i; + sum); 此程序完成的功能是:计算并输出1到100的立方和sum值。31、阅读以下程序


    注意事项

    本文(Java复习题阅读程序题软件.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开