With given options answer is C. Since input is read from user and it is not printed. Also System.console() might return null if console is not available and NPE might be thrown, but that option is not in answers.
import java.io.Console;
public class Main {
public static void main (String[] args) {
Console console = System.console();
char[] pass = console.readPassword("Enter password:"); // line n1
String password = new String(pass); // line n2
}
}
C:\cjava\809>javac Main.java
C:\cjava\809>java Main
Enter password:
C:\cjava\809>
Answer is C
This section is not available anymore. Please use the main Exam Page.1z0-809 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
asdfjhfgjuaDCV
9 months, 3 weeks agosteefaand
10 months, 3 weeks agoiSnover
10 months, 4 weeks agopush05
11 months, 2 weeks agoKim514
1 year, 8 months agoOhayou
2 years, 9 months agopetetsai
2 years, 11 months agoEason_from_the_future
3 years, 4 months agovancuver
3 years, 3 months agoSigamani
3 years, 7 months agojduarte
3 years, 8 months agoManuel7000
3 years, 9 months agofffff
3 years, 10 months agopul26
4 years ago