填空题对下列二叉树进行中序遍历的结果为{{U}}【4】{{/U}}。
填空题一个项目具有—个项目主管,—个项目主管可管理多个项目,则实体“项目主管”与实体“项目”的联系属于 【4】 的联系。
填空题catch子句都带一个参数,该参数是某个异常的类及其变量名(该异常对象的指针),catch用该参数去与抛出异常对象的类进行 【8】 。
填空题java.io包中有一个类同时实现了Datalnput接口和DataOutput接口,这个类是{{U}} 【8】 {{/U}}。
填空题通过参数定制Applet,请在下划线处编写适当语句 【15】 ,使程序能正确运行。 para_duke.html <HTML> <HEAD> <TITLE> A Simple Program </TITLE> </HEAD> <BODY> <applet code = DrawAny.class width = 100 height = 100 align = bottom> <param name = image value = "duke.gif"> </applet> </BODY> </HTML> DrawAny.java import java.awt.*; import java.applet.*; import java.net. URL; public class DrawAny extends Applet Image im; public void init() URL url = getDocumentBase(); String imageName = getParameter("image"); ______; public void paint(Graphics g) g.drawImage(im,0,0,this);
填空题下列是一个Java应用程序,输出结果是 ______。 public class Testtt public static void main(String args[]) char c='i'; for(int n=6;n<11;n++) if(n==8)break; System.out.print(c++);
填空题本题中,通过菜单“Connect”显示一个对话框,单击“ok”按钮后,所填写的内容就会传回到主窗口并显示出来。 import java. awt. * ; import java. awt. event. * ; import javax. swing. * ; public class java3 extends JFrame implements ActionListener public java3() setTitle("java3"); setSize(300,300); addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) System. exit(0); ); JMenuBar mbar=new JMenuBar(); setJMenuBar(bar); JMenu fileMenu=new JMenu("File"); mbar. add(fileMenu); connectItem=new JMenuItem("Connect"); connectltem. addActionListener(this); fileMenu. add(connectItem); exitItem=new JMenuItem("Exit"); exitItem. addActionListener(this); fileMenu. add(exitItem); public void actionPerformed(ActionEvent evt) Object source=evt. getSource(); if (source==connectItem) ConnectInfo transfer=new ConnectInfo("yourname", "pw"); if(dialog==null) dialog=new ConnectDialog(this); if(dialog. showDialog(transfer)) String uname=transfer. username; String pwd=transfer. password; Container contentPane=getContentPane(); contentPane. add(new JLabel("username="+uname+", password="+pwd), "South"); validate(); else if(source==exitItem) System. exit(0); public static void main(String[] args) JFrame f=new java3(); f. show(); private ConnectDialog dialog=null; private JMenuItem connectltem; private JMenuItem exitItem; class Connectlnfo public String username; public String password; public ConneetInfo(String u, String p) username=u; password=p; class ConnectDialog extends JDialog implements ActionListener public ConnectDialog() super(parent, "Connect", true); Container contentPane=getContentPane(); JPanel p1=new JPanel(); p1. setLayout(new GridLayout(2,2)); p1. add(new JLabel("User name:")); p1. add(username=new JTextField("")); p1. add(new JLabel("Password:")); p1. add(password=new JPasswordField("")) contentPane. add("Center", p1); Panel p2=new Panel(); okButton=addButton(p2,"Ok"); cancelButton=addButton(p2, "Cancel"); contentPane. add( "South", p2); setSize(240,120); JButton addButton(Container c, String name) JButton button=new JButton(name); button. addActionListener(this); c. add(button); return button; public void actionPerformed(ActionEvent evt) Object source=evt. getSource(); if(source==okButton) ok=true; setVisible(false); else if (source==cancelButton) setVisible(faIse); public void showDialog(ConnectInfo transfer) username. setText(transfer. username); password. setText(transfer. password); ok=false; show(); if(ok) transfer. username=username, getText(); transfer. password=new String(password. getPassword()); return ok; private JTextField username; private JPasswordField password; private boolean ok; private JButton okButton; private JButton cancelButton;
填空题请完善程序(程序文件名:Java_2.java)并进行调试。请在下画线处填入正确内容,然后删除下画线。请勿删除注释行和其他已有的语句内容。题目要求:显示一个窗口,并且在点击窗口右上方的“关闭窗口”按钮时,可以将窗口关闭。程序运行显示窗口如下图所示。源程序:importjava.awt.*;importjava.awt.event.WindowEvent;importjava.awt.event.WindowListener;publicclassJava_2extends(1)implementsWindowListenerpublicstaticvoidmain(Stringargs[])Java_2fr=newJava_2();fr.(2)(200,100);fr.setBackground(Color.green);(3)fr.setVisible(true);publicvoidwindowClosing((4)e)System.exit(0);publicvoidwindowClosed(WindowEvente)publicvoidwindowOpened(WindowEvente)publicvoidwindowlconified(WindowEvente)publicvoidwindowDeiconified(WindowEvente)publicvoidwindowActivated(WindowEvente)publicvoidwindowDeactivated(WindowEvente)
填空题软件生存周期包括软件定义、{{U}} 【2】 {{/U}}、软件使用和维护三个阶段。
填空题数据库系统由数据库、______、硬件平台、数据库管理员和软件平台所组成。
填空题若串s="Program",则其子串的数目是{{U}} 【1】 {{/U}}。
填空题从对象流中读取对象,请在画线处加入代码完成此程序{{U}} 【10】 {{/U}}。
import java.util.*;
import java.io.*;
public class UnSerializeDate
{
Date d = null;
UnSerializeDate()
{
try{
FileInputStream f = new FileInputStream("data.ser");
______;
d = (Date) s.readObject();
f.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String args[ ])
{
UnSerializeDate a = new UnSerializeDate();
System.out.println("The date read is :"+a.d.toString());
}
}
填空题Java的线程调度策略是一种基于优先级的________试调度。
填空题MouscEvcnL事件可以实现的监听接口是MouseListener和 【12】 。
填空题在Java语言中,如实型常量后没有任何字母,计算机默认为______类型。
填空题关系中的属性或属性组合,其值能够唯一地标识一个元组,该属性或属性组合可选做为 【5】 。
填空题在java.swing包中,定义了两种类型的构件:顶级容器和轻量级构件。其中顶级容器包括JFrame, JApplet, JDialog和{{U}} 【11】 {{/U}}。
填空题下列是一个类的定义,将程序段补充完整。 class A String s; 【11】 int a=66; A(String sl) s=sl; static int geta( ) return a;
填空题软件工程研究的内容主要包括: 【5】 技术和软件工程管理。
填空题设栈S和队列Q的初始状态为空,元素e1、e2、e3、e4、e5和e6依次通过栈S,一个元素出栈后即进入队列Q,若6个元素出队的顺序是e2、e4、e3、e6、e5、e1则栈S的容量至少应是{{U}} 【3】 {{/U}}。
