Solved

Consider the Following Code Snippet

Question 80

Multiple Choice

Consider the following code snippet:
Class MouseClickedListener implements MouseListener
{
Public void mouseClicked(MouseEvent event)
{
Int x = event.getX() ;
Int y = event.getY() ;
Component.moveTo(x,y) ;
}
Public void mousePressed(MouseEvent event) {}
Public void mouseEntered(MouseEvent event) {}
Public void mouseExited(MouseEvent event) {}
}
What is wrong with this code?


A) The class cannot have empty methods for the mousePressed, mouseEntered, and mouseExited methods.
B) The class failed to implement the mouseReleased method of the MouseListener interface.
C) The class has implemented the wrong interface.
D) The mouseClicked method cannot access the x and y coordinates of the mouse.

Correct Answer:

verifed

Verified

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

Related Questions