Solved

Consider the Following Code Snippet: Public Class ClickListener Implements ActionListener

Question 55

Multiple Choice

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents