Solved

Consider the Following Code Snippet

Question 71

Multiple Choice

Consider the following code snippet:
Class MyListener implements ActionListener
{
Public void actionPerformed(ActionEvent event)
{
System.out.println(event) ;
}
}
timer t = new Timer(interval, listener) ;
t.start() ;
What is wrong with this code?


A) The Timer object should be declared before the MyListener class.
B) The listener must be declared as new MyListener() .
C) The Timer object must be declared as final.
D) The word listener should be change to MyListener.

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