Search This Blog

Saturday, January 29, 2011

Question 15

Which of the following are true about the readPassword() method of the Console class? Select two choices.

Options :

A. Its return type is String.

B. It reads the password from the console.

C. It has echoing disabled.

D. It takes a single argument.

E. None of these.

Answers : B & C

The return type of readPassword method is char[] and not String. String is not used to represent password for security reasons as all the strings are stored inside a String pool. A malicious user can take advantage of that. So option A is incorrect. Option D is also incorrect as the API does not contain any readPassword() method with a single argument.

Java API for reference :image

Question 15SocialTwist Tell-a-Friend

No comments:

Post a Comment