问题 填空题

阅读下面代码:
import java.awt.*;
public class Exam11_1

private Frame f;
private Button b1,b2,b3,b4;
public static void main(String args[]

Exam11_1 that = new Exam11 1 ();
that.go();

public void go()

______;
f.setLayout(new FlowLayout()) ;;
b1 = 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);


请在程序中画线处填写正确的语句 【13】 ,以便编译运行程序后得到正确的结果。

答案

参考答案:f=new Frame("GUI example")

解析: 本题考查容器和布局管理器的基本知识,属于综合题。在本程序里,缺少建立Frame的语句,而且该Frame的名字为GUI example,而4个按钮的布局方式被压缩至最小,因此是 FlowLayou布局方式。

单项选择题 A1型题
单项选择题 A1/A2型题