题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-10-22 09:14:00

[简答题]阅读下列程序,请写出该程序的功能 。
import java. awt. event.*;import javax. swing. *;import java. awt.*;
public class MenuWindow extends JFrame implements ActionListener
JTextField text=new JTextField( );
JMenuBar menuBar;JMenu menuFruits;
JMenuItem menuIteml,menuItem2,menuItem3;
public MenuWindow( )
menuBar=new JMenuBar( );setJMenuBar(menuBar);
menuFruits=new JMenu("水果");menuBar. add(menuFruits);
menuItem1=new JMenuItem("苹果");menuItem1.addActionListener(this);
menuFruits.add(menuItem1);
menuItem2=new JMenuItem("桔子");menuItem2. addActionListener(this);
menuFruits. add(menuItem2);menuFruits. addSeparator( );
menuItem3=new JMenuItem("退出");menuItem3. addActionListener(this);
menuFruits. add(menuItem3);
Container con=getContentPane( );
con. add(text);setSize(200,150);setVisible(true);

public void actionPerformed(ActionEvent e)
if(e. getActionCommand( )=="退出")System. exit(0);

更多"阅读下列程序,请写出该程序的功能 。 import java. aw"的相关试题:

[简答题]阅读下列程序,请写出该程序的功能。
import java. awt. *;import java. awt. event. *;import java. applet. *;
public class Test34 extends Applet implements ActionListener
String msg=" ";Button bList[]=new Button[3];
public void init( )
Button yes=new Button("Yes");Button no=new Button("No");
Button maybe=new Button("Undecided");
bList[0]=(Button)add(yes);bList[1]=(Button)add(no);
bList[2]=(Button)add(maybe);
for(int i=0;i<3;i++) bList[i].addActionListener(this);

public void actionPerformed(ActionEvent ae)
for(int i=0;i<3;i++)
if(ae.getSource( )==bList[i])
msg="You pressed"+bList[i].getLabel( );


repaint( );

public void paint(Graphics g)g.drawString(msg,6,100);

[简答题]阅读下列程序,请写出该程序的功能。
import Java. applet.*;import javax. swing.*;
import java. awt.*;import Java. awt. event.*;
public class Test34 extends Applet implements ActionListener
JTextField text;int r;JPanel panel;
public void paint(Graphics g)
Graphics gc=panel. getGraphics( );
gc. clearRect(0,0, panel. getWidth( ),panel. getHeight( ));
gc. setColor(Color.red);gc.fillOval(10,10,r,r);

public void init( )
text=new JTextField(10);panel=new JPanel( );
setSize(200,100);setLayout(new GridLayout(2,1));
add(text);add(panel);text.addActionListener(this);

public void actionPerformed(ActionEvent e)
if(e. getSource( )==text)
r=Integer. parseInt(text. getText( ));
repaint( );



[简答题]阅读以下程序,请写出该程序的输出结果。
class CurrentThreadDemo
public static void main(String args[])
Thread t=new Thread( );System. out. println("Current thread");
t.setName("My Thread");System. out. println("After name change");
try for(int n=3;n>0;n--)
System. out. println(n);Thread. sleep(1000);

catch(InterruptedException e)
System.out.prindn("Main thread interrupted");



[简答题]阅读下列程序,请写出该程序的输出结果。
class MyThread extends Thread
String message,int s;
MyThread(String message,int sec)this. message=message;s=sec;
public void run( )
trysleep(s);catch(InterruptedException e)
System. out. println(message+" "+getPriority( ));


class ThreadTest
public static void main(String args[])
Thread foo=new MyThread("Foo",1000);
foo. setPriority(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( );


注:假设处理机中没有其他线程占用资源。
[简答题]阅读下列程序,请写出该程序的输出结果。
class Tree
private String name;public boolean flower;
public int birthYear;
Tree(String n,boolean f,int y)name=n;flower=f;birthYear=y;
public void setName(String n)name=n;
public String getName( ) return name;
public void printTree (String str)
System. out. println(str);System. out. println("Name:"+name);
System. out.println("Birth Year:"+birthYear);
System. out. println("Flower:"+flower);


class PineTree extends Tree
public boolean coniferous=true;
PineTree(String n,boolean f,int y,boolean c)super(n,f,y);coniferous=c;
public void printTree(String str)
super. printTree (str);
System. out. println("Coniferous:"+coniferous);


class Test32
public static void main(String[] args)
Tree fOb=new Tree("May Flower",true,1980);
PineTree sOb=new PineTree("Pine",false,2000,true);
fOb. printTree("fOb:");sOb. printTree("sOb:
[简答题]阅读下列程序,请写出该程序的输出结果。
class Test33
String myString="1";
public static void main(String args[])
Test33 myObj=new Test33( );
myObj. stringModifier(myObj. myString);
System. out. println(" "+myObj. myString);

void stringModifier(String theString)
theString=theString+"2";System. out. print(theString);


[简答题]阅读下列程序,请写出该程序的输出结果。
class Test32a
String name;int age;long number;
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);


public class Test32
public static void main(String args[])
Test32b abc=new Test32b(4747,"Tony",29,true);


[简答题]阅读下列程序,请写出该程序的输出结果。
class Test33
static void s(int b[],int k)
int i,j,t;
for(i=1;i<k;i++)
for(t=b[i],j=i-1;j>=0&&t<b[j];j--)
b[j+1]=b[j];
b[j+1]=t;


public static void main(String[]args)
inti,a[]=6,12,7,11,5;
s(a,5);
for(i=0;i<a.length;i++)System. out. print(a[i]+¨¨);
System. out. Println( );


[填空题]下面程序段是从对象流中读取对象,请将程序补充完整。
import java. util.*;
import java. io.*;
public class UnSerializaDate
Date d=null;
UnSerializaDate( )
try
FileInputStream f=new FileInputStream("date. ser");
ObjectInputStream s=new ObjectInputStream(f);
【13】
f. close( );

catch(Exception e)
e. printStackTrace( );


public static void main(String args[])
UnSerializaDate a=new UnSerializaDate( );
System. out. println("The date read is:" +a.d.toString( ));


[填空题]请写出下面程序的运行结果:
public class Test extends TT
public static void main(String args[])
Test t=new Test("Tom.");

public Test(String s)
super(S);
System.out.print("How are you");

public Test( )
this("I am Jack.");


class TT
public TT( )
System.out.print("Hi!");

public TT(String s)
this( );
System.out.print("I am" +s);


结果:______。
[填空题]请写出下面程序的运行结果: public class Test extends TT{ public static void main(String args[] Test t=new Test ("Tom."); } public Test(String s){ super (s); System.out.print("How are you"); } public Test( ){ this("I am Jack."); } } class TT{ public TT( ){ System.Out.print ("Hi!"); } public TT(String s){ this ( ); System.out.print("I am"+s); } } 结果: 【15】
[填空题]请写出下面程序的运行结果: public class Test extends TT{ public static void main(String args[]){ Test t=new Test("Tom."); } public Test(String s){ super(s); System.out.print("How are you"); } public Test( ){ this("I am Jack."); } } class TT{ public TT( ){ System.out.print("Hi!"); } public TT(String s){ this( ); System.out.print("I am"+s); } } 结果【 】。
[简答题]请写出下列程序段的输出结果,并说明理由。
X=2
Y=3
X, Y
DO SUB1
X, Y
PROCEDURE SUB1
PRIVATE Y
X=4
Y=5
RETURN
[简答题]请写出Modern的含义和功能。
[简答题]请写出在Windows中,启动应用程序的两种方法。
[简答题]请写出Java语言中编写事件处理程序的两种方案。
[简答题]请写出下面C语言程序输出结果。 #include<stdio.h> int x=3; void main( ) {int i; for(i=1;i<x;i++)incre( );) void incre( ) { static int x=1; x=x+1; printf("%d",x); }
[简答题]当Client程序和Server程序需要通信时,可以用Socket类建立套接字连接,请写出双方实现通信的两种方式。
[简答题]请写出TCP/IP网络的层次结构,并简述数据链路层的功能。

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码