首页 > 大学专科> 电子信息
题目内容 (请给出正确答案)
[主观题]

请在代码中的画线处填写正确的语句【 】,使程序输出hello world!。 //HelloApplet.java Im

port java.awt.*; Import java.applet.*; Public class HelloApplet extends { Public void paint(Graphics g) { ______ ("hello world!",20,20); } }

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“请在代码中的画线处填写正确的语句【 】,使程序输出hello…”相关的问题
第1题
阅读下面代码: import java.awt.*; public class Exam11_1 { private Frame.
f; private Button bl,b2,b3,b4; public static void main(String args[] { Exam11_1 that = new Exam11_1 (); that.go(); } public void go () { ______; f.setLayout(new FlowLayout());; bl = new Button ("Button 1"); b2 = new Button ("Button 2"); b3 = new Button ("Button 3"); b4 = new Button ("Button 4"); f.add(b1); f.add(b2); f.add(b3); f.add(b4); f.pack(); f.setVisible(true); } } 请在程序中画线处填写正确的语句【 】,以便编译运行程序后得到正确的结果。

点击查看答案
第2题
阅读下面代码: import java.awt.*; public class Examll_2 { public static v
oid main(String args[]) { ______; f.add("North",new Button("North")); f.add("South",new Button("South")); f.add("East",new Button ("East")) ;; f.add("West",new Button("West")); f.add("Center",new Button ("Center")); f.pack (); f.setVisible(true); } } 请在程序中的画线处添上适当的语句【 】,使程序能正确执行。

点击查看答案
第3题
阅读下面代码: import java.awt.*; public class Exam11_2 { public static
void main (String args[]) { ______; f.add("North",new Button("North")); f.add("South",new Button("South")); f.add("East",new Button("East"));; f.add("West",new Button("West")); f.add("Center",new Button("Center")); f.pack(); f.setVisible(true); } } 请在程序中的画线处添上适当的语句【 】,使程序能正确执行。

点击查看答案
第4题
从对象流中读取对象,请在画线处加入代码完成此程序【 】。 import java.util.*; import ja
va.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()); } }

点击查看答案
第5题
bar为一JSerollBar组件,阅读下面程序段,请在程序中的画线处填入正确的语句使程序能够正确运行。
… public WellAdjusted() { super("Well Adjusted"); setSize(350,100); bar.addAdjustmentListener(this); value.setHorizontalAlignment(SwingConstants.CENTER); value.setEditable(false); JPanel pane=new JPane(); pane.setLayout(new BorderLayout()); pane.add(value,"Center"): pane.add(bar,"South"); setContentPane(pane); } public void adjustmentValueChanged(AdjustmentEvent evt) { 【 】 if(source==bar) { int newValue bar.getValue(); value.setText(""+newValue); } repaint(); } …

点击查看答案
第6题
bar为一JScrollBar组件,阅读下面程序段,请在程序中的画线处填入正确的语句使程序能够正确运行。
... public WellAdjusted() { super("Well Adjusted"); setSize(350,100); bar.addAdjustmentListener(this); value.setHorizontalAlignment(SwingConstants.CENTER); value.setEditable(false); JPanel pane = new JPane(); pane.setLayout(new BorderLayout()); pane.add(value,"Center"): pane.add(bar,"South"); setContentPane(pane); } public void adjustmentValueChanged(AdjustmentEvent evt) { 【 】 if(source ==bar) { int newValue bar.getValue(); value.setText(""+newValue); } repaint(); }

点击查看答案
第7题
有如下代码片段,请在画线处填入正确的代码,使程序运行正确。 import javax.swing.*; im
port java.awt.*; import java.event.*; public class JAppletTest extends【 】{ public void init() { Container contentPane = getContentPane(); Icon icon = new ImageIcon("swing.gif", "A GIF on a swing"); JLabel label = new JLabel("Swing!", icon, SwingConstants.CENTER); contentPane.add(label, BorderLayout.CENTER); } }

点击查看答案
第8题
下面MyFrame类创建了一个简单容器。 import javax.swing.JFrame; public class MyFrame.
extends【 】 { public MyFrame() { super("MyFrame"); setSize(300,100); setDefaultCloseOperation(JFrame.EXIT ON CLOSE); setVisible(true); } public static void main(String[] arguments) { MyFrame. mf= new MyFrame(); } } 请在画线处添上正确的语句,使得程序能够正确运行。

点击查看答案
第9题
下面ButtonFrame类创建了一个容器,包含有3个按键。 import javax.swing.*; public class
ButtonFrame. extends JFrame. { JButton Button1= new JButton("Button1"); JButton Button2= new JButton("Button2"); JButton Button3= new JButton("Button3"); public ButtonFrame() { super("ButtonFrame"); setSize(100,150); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPane1 pane = new JPanel(); pane.add(Buttonl); pane.add(Button2); pane.add(Button3); 【 】; } public static void main(String args[]) { ButtonFrame. bf= new ButtonFrame(); bf.show(); } } 请在程序代码中的画线处添上正确的语句,使程序完整。

点击查看答案
第10题
通过实现Runnable接口创建线程,请在画线处加入正确的代码完成此程序【 】。 public class Thre
adTest { public static void main(String args[ ]) { Thread t1=new Thread(new Hello()); Thread t2=new Thread(new Hello()); ______; t2.start(); } } class Hello implements Runnable { int i; public void run() { while(true) { System.out.println("Hello"+i++); if(i==5) break; } } }

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改