问题 填空题

如图所示 。


程序如下:
//Java_3.html
import java.awt.*;
import java.awt.event.*;
//**********Found**********
public class Java_3 ______ ActionListener

public static void main(String args\[\])

Java_3 tb=new Java_3();
Frame f=new Frame("Button Test");
f.setSize(200, 100);
f.setLayout(new FlowLayout(FlowLayout.CENTER));
Button b=new Button("Press the Button!");
//**********Found**********
b.______(tb);
f.add(b);
f.setVisible(true);

public void actionPerformed(ActionEvent e)

Frame fr=new Frame("An Other");
fr.setBackground(Color.green);
fr.add(new Label("This frame shows when "+" pressing the button in Button Test"));
fr.pack();
fr.setVisible(true);


答案

参考答案:addActionListener

解析: 本程序中定义的类Java_3实现了ActionListener接口,所以第一处应填入“implements”。在main()方法中,实例化Java_3的一个对象tb,根据向上的传递性,tb也具有ActionListener接口的方法和属性,所以在为Button注册监听器时用到了b.addActionListener(tb)方法,所以第二处应填入“addActionListener”。

完形填空

People wear hats for three main reasons: protection, communication, and decoration.

Protection. People first began to wear hats to ___1___ themselves from the climate. In hot, sunny climates, wide-edged hats provide ___2___ from the sun. In cold climates, people often wear wool hats. In some regions, people wear a variety of protective hats, ___3___ the season. They may wear a wool hat in winter, a rain hat in spring or fall, and a wide-edged hat in summer. Hats also provide protection in certain ___4___. Construction workers, football players, military personnel, and people in many other fields wear metal or plastic helmets(头盔)for protection from ___5___.

Communication. Hats can communicate various things about the people who wear them. The hats of coal miners, cowboys and firemen indicate the wearer's ___6___. Students may wear a mortarboard (学位帽) to show they are graduating from high school or college.

Decoration. Most people wear a hat that they believe makes them look attractive, ___7___ the hat's main purpose may be protection or communication. Many protective hats are attractive and stylish. Even the caps of police officers and military personnel are designed to ___8___ the wearer's appearance. Certain decorative hats are worn as a (n) ___9___. In Scotland, for example, people wear a cap called a tam-o'-shanter that is part of their national costume (服装). Many people change their style of hat from time to time because they feel more ___10___ when keeping up with the latest fashion.

1. A. defend     B. protect    C. prevent   D. hide

2. A. shade    B. shadow      C. security    D. cover

3. A. resulting from  B. basing upon  

C. relating to  D. depending on

4. A. seasons      B. climates     C. activities    D. communities

5. A. injury     B. destruction   C. harm   D. pollution

6. A. experience     B. occupation  C. personality  D. education

7. A. as   B. unless   C. though  D. because

8. A. change    B. increase   C. display   D. improve

9. A. tradition  B. label    C. honour     D. fashion

10. A. sociable    B. informal    C. attractive    D. noble

单项选择题