免费预览已结束,剩余3页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
难度级别:3知识点:继承(5-4)试题内容:class Art Art() System.out.println(Art constructor); class Drawing extends Art Drawing() super(); System.out.println(Drawing constructor); public class Cartoon extends Drawing Cartoon() super(); System.out.println(Cartoon constructor); public static void main(String args) Cartoon x = new Cartoon(); 难度级别:3 知识点:继承(5-4)试题内容:class Game Game(int i) System.out.println(Game constructor); class BoardGame extends Game BoardGame(int i) super(i); System.out.println(BoardGame constructor); public class Chess extends BoardGame Chess() super(11); System.out.println(Chess constructor); public static void main(String args) Chess x = new Chess(); 难度级别:3 知识点:继承(5-4)试题内容:class Vehicle public void drive() System.out.println(Vehicle: drive);class Car extends Vehicle public void drive() System.out.println(Car: drive);public class Test public static void main (String args ) Vehicle v= new Vehicle();Car c= new Car();v.drive();c.drive();v = c;v.drive();难度级别:3 知识点:构造函数的重载(5-3)试题内容:写出下面程序的输出结果class C0 public C0(int x) System.out.println(C0+x); C0() System.out.println(C0); class C1 extends C0 public C1(int x) System.out.println(C1+x); public static void main (String args) new C1(1); 难度级别:3知识点:构造函数的重载(5-3)3、试题内容:写出下面程序的输出结果class Parent Parent() System.out.println(调用父类的parent()构造方法);class SubParent extends Parent SubParent() System.out.println(调用子类的SubParent()构造方法);public class Subroutine extends SubParent Subroutine() System.out.println(调用子类的Subroutine()构造方法);public static void main(String args) Subroutine s = new Subroutine();难度级别:3 知识点:构造函数的重载(5-3)试题内容:class Test public static int MAX=100; Test() System.out.println(调用无参构造方法); Test(int i) System.out.println(调用有参构造方法); public int f(int a) return a+Test.MAX; public int f(int a,int b) return a+b; public class TestDemo public static void main(String args) System.out.println(Test.MAX); Test t1=new Test(); System.out.println(t1.f(10,20); Test t2=new Test(10); System.out.println(t2.f(10); 难度级别:3 知识点:构造函数(4-1)试题内容:查看下列程序并指出其输出结果。class Apublic A()System.out.println(A is called);class B extends Apublic B()super();System.out.println(B is called);public B(String x)super();System.out.println(B is called and input is +x);class C extends Bpublic C()System.out.println(C is called);public C(String x)super(x);System.out.println(c is called and input String is +x);public static void main(String args)new C(how are you);难度级别:3知识点:构造函数(4-1)试题内容:以下程序的输出结果是 。public class Test extends TT public static void main ( String args ) Test t = new Test (Tom); public Test(String s ) super(s); System.out.println(How do you do?); public Test() this (I am Jack); class TT public TT() System.out.println(What a pleasure!); public TT(String s) this(); System.out.println(I am +s); 难度级别:3 知识点:重载试题内容:public class Exam3_3public static void main(String args) System.out.println( test(15,26,4) ); static int test(int x, int y, int z) return test( x, test(y,z);static int test(int x,int y) if(xy) return x; else return y;难度级别:3 知识点:重载(5-3)试题内容:以下程序段的输出结果为 。class IntORString void iosM( int i ) System.out.print(“Integer ”); void iosM(String s) System.out.print(“String ”); public static void main(String args ) IntORStringios=new IntORString ( );ios.iosM(a);ios.iosM(“1”);难度级别:3知识点:重载(5-3)3、试题内容:以下程序段的输出结果为 public class OverLoadTest public static int add(int a, int b) return a + b;public static double add(double a, double b) return a + b;public static int add(int a) return a;public static int add(int a, double b) return 1;public static int add(double a, int b) return 1;public static void main(String args) System.out.println(调用add(int,int)方法: + add(1, 2);System.out.println(调用add(double,double)方法: + add(2.1, 3.3);System.out.println(调用add(int)方法: + add(1);难度级别:3知识点:重载(5-3)试题内容:以下程序段的输出结果为 public class Yikespublic static void go(long n)System.out.println(long);public static void go(short n)System.out.println(short);public static void go(int n)System.out.println(int);public static void main(String args)short y=6;long z=7;go(y);go(z);难度级别:3知识点:对象的比较试题内容:以下程序的输出结果是 。class Compare public static void main(String args) String str1 = new String(abc);String str2 = new String(abc);String str3 = str1;if(str1=str2)System.out.println(str1=str2);elseSystem.out.println(str1!=str2);if(str1=str3)System.out.println(str1=str3);elseSystem.out.println(str1!=str3); 难度级别:3知识点:异常3、以下程序段的输出结果为 public class DemoFinallypublic static void main(String args) String members=new String4;for(int count=0;count3;count+)tryint x;if (count=0) x=1/0;if (count=1) members4=jishou;if (count=2) return; catch(ArrayIndexOutOfBoundsException e)System.out.println(下标越界);catch(ArithmeticException ex)System.out.println(被零除); continue;finally System.out.println(这条语句总会被执行);二、按要求编写程序:1.(1)编写一个父类Test,其中有两个构造方法(一个有参数,一个没有参数)和一个方法fun()。(2)编写一个子类Test2继承Test类,也有两个构造方法(一个有参数,一个没有参数),其中无参的构造方法调用父类对应的构造方法;重写方法fun(),
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 儿童主持人培训课程体系设计
- 小学六年级语文期中考试试题及解析
- 部编版五年级语文单元学习任务单
- 餐饮食品原料采购与质量控制细则
- 园林绿化现场管理周计划与工作总结
- 电梯安全检查操作规程详解
- 房屋拆除施工合同标准范文全集
- 水处理设备维护保养操作规程
- 生产计划排程及物料需求管理指南
- 校区协作协议承诺函(5篇)
- 工厂天然气安全培训课件
- 2025年信用报告征信报告详版个人版模板样板(可编辑)
- 2025秋南水北调生态环保工程有限公司招聘(15人)笔试考试备考试题及答案解析
- 招标代理机构合同范本
- 【MOOC】《动物生理学实验》(华中农业大学)期末考试慕课答案
- 全国大学生职业规划大赛《蒙医学》专业生涯发展展示【高职(专科)】
- 2025江苏省数据集团第二批招聘考试参考试题及答案解析
- ISO9001-2026质量管理体系标准要求讲解、运用、推行培训教材
- 2025年文化体育活动中心建设项目可行性研究报告
- 湖南省医保知识培训课件
- 2025四川攀枝花市仁和区事业单位秋季引才19人考试参考题库及答案解析
评论
0/150
提交评论