Consider the following code snippet: public class ClickListener implements ActionListener
{
Public void actionPerformed(ActionEvent event)
{
System.out.println("I was clicked.") ;
}
}
Public class ButtonTester
{
Public static void main(String[] args)
{
JFrame frame = new JFrame() ;
JButton button = new JButton("Click me!") ;
Frame.add(button) ;
ActionListener listener = new ClickListener() ;
Button.addActionListener(listener) ;
) ..
}
}
Which of the following statements is correct?
A) Class ButtonTester is an interface type.
B) A ClickListener object can be added as a listener for the action events that buttons generate.
C) Class ClickListener is an interface type.
D) Class ButtonTester implements an interface type.
Correct Answer:
Verified
Q50: The methods of a/an _ describe the
Q51: An inner class can access local variables
Q52: A/an _ belongs to a class whose
Q53: Which of the following statements will compile
Q54: Which of the following statements about an
Q56: When an event occurs, the event source
Q57: Consider the following code snippet:
Import _
Import java.awt.event.ActionListener;
/**
An
Q58: Which of the following is an event
Q59: Which of the following statements about events
Q60: Consider the following code snippet: JFrame frame
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents