ImageVerifierCode 换一换
格式:DOC , 页数:8 ,大小:48.50KB ,
资源ID:2306259      下载积分:20 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.docduoduo.com/d-2306259.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(2011年10月全国自考Java语言程序设计(一)试题new.doc)为本站会员(dzzj200808)主动上传,道客多多仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知道客多多(发送邮件至docduoduo@163.com或直接QQ联系客服),我们立即给予删除!

2011年10月全国自考Java语言程序设计(一)试题new.doc

1、1全国 2011 年 10 月自学考试 Java 语言程序设计(一)试题课程代码:04747一、单项选择题(本大题共 10 小题,每小题 1 分,共 1O 分) 在每小题列出的四个备选项中只有一个是符合题目要求的,请将其代码填写在题后的括号内。错选、多选或未 选均无分。 1下面供选字符序列中,不属于 Java语言关键字的是 ( ) A. throw B. synchronized C. protect D. try 2以下程序代码的输出的结果是 ( ) double x = 25.6; System.out.println(int)x = KeyEvent.VK_A public void k

2、eyTyped(KeyEvent e) 4public void keyReleased(KeyEvent e) 30以下程序的界面有一个文本区 text,一个按钮 button。程序运行时,单击按钮,则 将文本区中的内容输出到 out,其中 out为 BufferWriter类的一个对象。 public void actionPerformed(ActionEvent e) String s; if(e._= button) try out. _(text.getText(),0,(text.getText().length(); out. flush(); text.setText(nul

3、l); System.exit(0); catch(IOException exp) text.setText(“文件定出错! n“); System.exit(-1); 31数据库连接方法 connectByJdbcOdbc()按给定的数据库 URL、用户名和密码连接数 据库,如果连接成功,方法返回连接对象,连接不成功,则返回空。 public static Connection connectByJdbcOdbc(String url, String usemame, String password) Connection con = null; try Class. _(“sun.jdb

4、c.odbc.JdbcOdbcDriver“); catch (Exception e) e.printStackTrace(); return null; try con =_.getConnection(url, usemame, password); catch (SQLException e) e.printStackTrace(); return null; return con; 五、程序分析题(本大题共 5 小题,每小题 4 分,共 20 分) 32阅读下列程序,请写出该程序的输出结果。 5class Test32a String name; int age; long numb

5、er; Test32a(long number, String name,int age) System.out.println(“Name: “+name); System. out. println(“Age: “+age); System.out.println(“Tel: “ +number); class Test32b extends Test32a Test32b(long number, String name,int age,boolean b) super(number, name,age); System.out.println(“Married: “+b); publi

6、c class Test32 public static void main(String args) Test32b abe=new Test32b(4747,“Tony“,29,true); 33阅读下列程序,请写出该程序的输出结果。 class Test33 String myString = “1“; public static void main(String args) Test33 myObj = new Test33(); myObj.stringModifier(myObj.myString); System.out.println(“ “+ myObj.myString);

7、 void stringModifier(String theString) theString = theString + “2“; System.out.print(theString); 34阅读下列程序,请写出该程序的功能。 import java.awt.*; import java.awt.event.*; import java.applet.*; public class Test34 extends Applet implements ActionListener String msg = “; Button bList = new Button3; public void

8、init() Button yes = new Button(“Yes“); Button no = new Button(“No“); 6Button maybe = new Button(“Undecided“); bList0 = (Button) add(yes); bList 1 = (Button) add(no); bList2 = (Button) add(maybe); for(inti= 0;i 3; i+) bListi.addActionListener(this); public void actionPerformed(ActionEvent ae) for(int

9、 i = 0;i 3; i+) if(ae.getSource() = bListi) msg = “You pressed “+ bListi.getLabel(); repaint(); public void paint(Graphics g) g.drawString(msg, 6, 100); 35阅读下列程序,请写出该程序的功能。 import java.awt.event.*; import javax.swing.*; import java.awt.*; public class MenuWindow extends JFrame implements ActionListe

10、ner JTextField text = new JTextField(); JMenuBar menuBar; JMenu menuFruits; JMenultem menultem1,menultem2,menultem3; public MenuWindow() menuBar = new JMenuBar(); setJMenuBar(menuBar); menuFruits = new JMenu(“水果“); menuBar.add(menuFruits); menultem 1 = new JMenultem(“苹果“); menultem1 .addActionListen

11、er(this); menuFruits.add(menultem1 ); menultem2 = new JMenultem(“桔子“); menultem2.addActionListener(this); menuFruits.add(menultem2); menuFruits.addSeparator(); menultem3 = new JMenultem(“退出“); menultem3.addActionListener(this); menuFruits.add(menultem3); Container con = getContentPane(); con.add(tex

12、t); setSize(200,150); setVisible(true); public void actionPerformed(ActionEvent e) if (e.getActionCommand() = “退出“) System.exit(0); else text.setText(e.getActionCommand(); 7 public static void main(String args) MenuWindow mw = new MenuWindow(); 36阅读下列程序,请写出该程序的输出结果。 class MyThread extends Thread Str

13、ing message; int s; MyThread(String message, int sec) this.message = message; s = sec; public void run( ) try sleep(s); catch(InterruptedException e) System.out.println(message+“ “+getPriority( ); class ThreadTest public static void main(String args) Thread foo = new MyThread(“Foo“, 1000); foo.setPr

14、iority(Thread.MIN_PRIORITY); foo.start( );Thread bar = new MyThread(“Bar“,800); bar.setPriority(3); bar.start( ); Thread gar = new MyThread(“Gar“,400); gar.setPriority(7); gar.start( ); Thread kar = new MyThread(“Kar“, 100); kar.setPriority(Thread. MAX_PRIORITY); kar.start( ); ) 注:假设处理机中没有其它线程占用资源。

15、六、程序设计题(本大题共 2 小题,每小题 6 分,共 12 分) 37.请编写一个方法 int findMaximum(intnumbers),要求该方法返回二维数组中元素 的最大值。838小应用程序的 paint(Gmphics g)方法能在屏幕窗口上显示信息和绘图,如果 paint()方法能调用repaint()方法,这就能使显示实现动态效果,repaint()方法的功能是先清除 paint()方法以前所画的内容,然后再调用 paint()方法。 以下要你编写的 paint()方法取随机的坐标位置画一个边长为 20个像素的红色正方形。其中随机的坐标位置可以用以下表达式表示: (int)(Mathrandom()*100)+10 另要求 paint()方法在绘制正方形后暂停 100毫秒。 import javaapplet*;import javaawt*; public class Class 1 extends Applet public void paint(Graphicsg) 请在以下位置编写代码

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报