Solved

Consider the Following Code Snippet

Question 5

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 listens 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