




已阅读5页,还剩14页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1.下列说法说法正确的是(b) a. java.lang.clonable是类 /是接口b. java.lang.runnable是接口 c. double对象不在java.lang包中 /在d. double a=1.0是正确的java语句 /double a=1.0;2、编译java程序的命令文件名是(b)ajava.exeb.javac.exec.javacd.appletviewer.exe 3.选出合法的标识符(a c) a. _sysl_111b. 2mail /数字不能开头c. g$changed. class /保留字4、给出下列代码:public class person static int arr=new int10;public static void main(string a)system.out.println(arrstr1);下列说法正确的是(c)a.编译时将产生错误; b.编译时正确,运行时将产生错误; c.输出零; d.输出空格; 5指出下列程序运行的结果 (b)public class example string str=new string(good); char ch=a,b,c; public static void main(string args) example ex=new example(); /ex对象 ex.change(ex.str,ex.ch); system.out.print(ex.str+ and ); sytem.out.print(ex.ch); public void change(string str,char ch) this.str=test ok; this.ch0=g; a good and abcb good and gbcc test ok and abcd test ok and gbc6.欲构造 arraylist类的一个实例,下列哪个方法是正确的(b) 上塑 a arraylistobject mylist=new objectarraylist() /下塑b arraylist mylist=new arraylist()c mylist=new object()d mylist=new arraylist()7.下列哪个类声明是正确的(d)a程序员必须创建一个线程来释放内存babstract private move();cprotected private number;dpublic abstract class car 8.二维数组arrayofint的一维数组的个数_a_。int arrayofint=new int34;aarrayofint.length barrayofinti.lengthcarrayofint.length() string str=”abc”; str.length(); darrayofinti.length()9.类的成员访问修饰符默认(即无修饰)时,限制访问_c_。a同一类 b同包 c不同包,子类 d同包,非子类10.如果想要限制在当前类之外对某个成员变量的访问,应该选择如下哪一种(b)a.publicb.privatec.protectedd.不需要任何修饰符11以下说法错误的是_b_。a一个类若有子类,则一定要有无参数的构造方法。b在重载实现多态性的方式中,子类重定义父类方法时,方法的名字、参数个数、类型、顺序应完全相同。c父类与子类间具有共享性、差异性、层次性的关系。d若实现某接口的类是abstract的抽象类,则他可以不实现该接口的所有方法。12.如右图布局,java是由_c_语句来实现它的。a.flowlayoutb.borderlayout c.gridbaglayout d.garderlayout13.对于构造函数,下列叙述不正确的是(c)。a、构造函数也允许重载。b、子类无条件地继承父类的无参构造函数。c、子类不允许调用父类的构造函数。superd、在同一个类中定义的重载构造函数可以相互调用。 this14.分析下列程序class superpublic static int i=0;public super(string text)i=1;public class sub extends superpublic sub (string text) i=2;public static void main(string args)super super=new super(“str”);sub sub = new sub(“hello”);system.out.println(super.i); 2system.out.println(sub.i); 2该程序的结果是(a)a编译失败b.编译成功且输出0c. 编译成功且输出1 d. 编译成功且输出215.以下代码中,this 是指 ( a)class bird int x,y; void fly(int x,int y )this.x=x ;this.y=y; a bird b. fly c、bird 或 fly d、不一定16.设有下面的一个类定义:class aa static void show( ) system.out.println(“我喜欢java!”); class bb void show( ) system.out.println(“我喜欢c+!”); 若已经使用aa类创建对象a和bb类创建对象b,/ aa a=new aa();/ bb b=new bb();则下面哪一个方法调用是正确的:( a c )a、a.show( ) b、 aa.show( );对b.show( ) bb.show( );c、aa.show( ); d、a.show( );b.show( ); bb.show( );17.给出下面代码: 1) class parent 2) private string name; 3) public parent() 4) 5) public class child extends parent 6) private string department; 7 public child() 8 public string getvalue() return name; 9 public static void main(string args) 10 parent p = new parent(); 11 12 那些行将引起错误? ( d )a、 第3行 b、 第6行 c、 第7行 d、 第8行18.下列哪个选项为真(d)a.error类是一个runtimeexception异常b.任何抛出一个runtimeexception异常的语句必须包含在try块之中c.任何抛出一个error对象必须包含在try块之中d.任何抛出一个exception异常的语句必须包含在try块之中19.下列程序public class exceptiontestclass testexception extends exceptionpublic void runtest() throws testexceptionpublic void test() /* point x */runtest();在该程序的point x 处,增加下列哪个程序才能通过编译?(a)a. throws exceptionb.catch (exception e)c. throws runtimeexceptiond.catch(testexception e)20. 欲编写如下图的一个界面,用于显示用户指定的图像: 如果在区域a中只能放置一个awt组件,从各组件的本来功能角度考虑,最好使用哪种组件:( b )a、 textarea b、 panel /容器c、 applet d、 canvas /不是容器21. 下面关于applet的说法正确的是 ( b )a、 applet也需要main方法 /paintb、 applet必须继承自java.awt.applet c、 applet能访问本地文件 /java安全性d、 applet程序不需要编译 22. 看下面一段程序:( c ) class aclass void go() system.out.println(aclass); public class bclass extends aclass void go() system.out.println(bclass); public static void main(string args) aclass a=new aclass(); bclass a1=new bclass(); a.go(); a1.go(); 以上程序运行结果是: a、 aclass aclass b、 bclass bclass c、 aclass bclass d、 bclass aclass 23.类abc定义如下:1public class abc2 public int max( int a, int b) 34将以下哪个方法插入行3是不合法的。(b )a、public float max(float a, float b, float c) b、public int max (int c, int d) c、public float max(float a, float b) d、private int max(int a, int b, int c) 24. 以下哪项可能包含菜单条( b )。a、panel b、frame c、applet d、dialog25. paint()方法使用哪种类型的参数? ( a )a、graphics b、graphics2d c、string d、color26. 下面哪个不是java中的容器? (a )a、canvas b、scrollpane c、applet d、dialog28. a派生出子类b ,b派生出子类c,并且在java源代码中有如下声明:a a0=new a();a a1 =new b();a a2=new c();问以下哪个说法是正确的?(d )a、只有第1行能通过编译b、第1、2行能通过编译,但第3行编译出错c、第1、2、3行能通过编译,但第2、3行运行时出错d、第1行、第2行和第3行的声明都是正确的29. 以下关于继承的叙述正确的是( a )。a、在java中类只允许单一继承b、在java中一个类只能实现一个接口c、在java中一个类不能同时继承一个类和实现一个接口d、在java中接口只允许单一继承30. 在编写java applet程序时,若需要对发生的事件作出响应和处理,一般需要在程序的开头写上(d )语句。a、import java.awt.*; b、import java.applet.* ;c、import java.io.*; d、import java.awt.event.*;31.阅读下列程序import java.awt.*;public class test extends framepublic test()add(new label (“hello”);add(new testfield (“hello”);add(new button(“hello”);pack();setvisible(true);public static void main(string args)new test();该程序的结果是(b)a.代码不能通过b.显示一个窗口,仅包含一个按钮c.在第六行抛出一个illegalargumentexception异常d.出现一个空窗口填空1.下面程序的运行结果是class parent void printme() system.out.println(”i am parent!”); class child extends parent void printme() system.out.println(”i am child!”); void printall() super.printme(); this.printme(); this.printme(); public class test_this public static void main(string args) child myc=new child(); myc.printall(); 答:运行结果为: i am parent! i am child! i am child!2. 下面程序的运行结果是int i; for(i=0;i5;i+) if(i=3) continue;system.out.print(i); system.out.println(”i=”+i);答:运行结果:0 1 2 4 i=53.下面的小程序中,有一个文本框,在其内输入完字符并按回车键后,文本框内就会显示“欢迎您”的字符串,填空完成该功能。import java.applet.*;import java.awt.*;import java.awt.event.*;public class applet1 extends applet implements _ textfield text; public void init() text=new textfie
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 乡村农业生态园区开发合作协议
- 2025年新余危险品考试题考试
- 房产买卖及交易合同
- 农户家庭农场农事承包经营合同
- 月度收入及年终奖金详细证明(5篇)
- 软件开发项目外包合同验收及流程指南
- 投资合作协议书式规范
- 正式离职证明与劳动经历确认(8篇)
- 深入了解市政学考试纲要试题及答案
- 施工合同谈判与风险管理试题及答案
- GB/T 1355-2021小麦粉
- 无人机结构与系统-第1章-无人机结构与飞行原理课件
- (完整)中小学教师高级职称专业水平能力试题库及答案(通用版)
- 2023年STD温盐深剖面仪行业分析报告及未来五至十年行业发展报告
- 护理管理中的组织沟通课件
- 脑性瘫痪儿童的康复 认识脑性瘫痪
- 高二历史必修1上册第11课 中国古代的民族关系与对外交往 知识点
- 公安机关人民警察基本级执法资格考试题库及答案
- 泌尿系结石课件
- 重庆市历年中考语文标准答题卡
- DB34-T 4016-2021 健康体检机构 建设和管理规范-高清现行
评论
0/150
提交评论