Sunday, 9 August 2009

Java Certification Question 0059

Which of the following statements are true?

1) The x,y coordinates of an instance of MouseEvent can be obtained using the getX() and getY() methods
2) The x,y coordinates of an instance of MouseEvent can be obtained using the X and Y integer fields
3) The time of a MouseEvent can be extracted using the getTime() method
4) The time of a MouseEvent can be extracted using the when parameter of the MouseEvent constructor


Answer 1 and 4:

1) The x,y coordinates of an instance of MouseEvent can be obtained using the getX() and getY() methods
4) The time of a MouseEvent can be extracted using the when parameter of the MouseEvent constructor

If you chose option 4, referring to the mythical getTime method you have made a reasonable guess based on the normal conventions of Java. However the conventions do not always hold true. If you chose option 3 perhaps you are not as aware of the conventions as you should be.

No comments:

Post a Comment