[单项选择题] 下列程序实现了2个监听器接口:ActionListener和W1ndowListener。import java.awt.*; import java.awt.event.*;

15 查阅

[单项选择题] 下列程序实现了2个监听器接口:ActionListener和W1ndowListener。import java.awt.*; import java.awt.event.*; public class ex39______ { public static void main(String[] args) { ex39 obj = new ex39(); obj .go(); } public void go() { Frame f = new Frame("ex39"); f.addWindowListener(this); Button b = new Button("Button"); b.addActionListener(this); f.add(b); f.pack(); f.setVisible(true); } public void actionPerformed(ActionEvent e) { System.out.println("Button pressed!"); } public void windowActivated(WindowEvent e){} public void windowDeactivated(WindowEvent e){} public void windowClosed(WindowEvent e) {} public void windowClosing(WindowEvent e){System.exit(1); public void windowIconified(WindowEvent e){} public void windowDeiconified(WindowEvent e) {} public void windowOpened(WindowEvent e){} } 请选择正确的语句填入横线处。

A.extends ActionListener, WindowListener

B.implements ActionListener, WindowListener

C.implements ActionListener; WindowListener

D.extends ActionListener; WindowListener

参考答案:

B

计算机考试