Exam 1z0-809 All QuestionsBrowse all questions from this exam
Question 107

Given the code fragment:

What is the result?

    Correct Answer: C

    The code reads the password without echoing characters on the console. The System.console() returns a console object which is used to read the password without displaying it. Therefore, there will be no compilation error at either line n1 or line n2, and the IOException is not relevant in this context.

Discussion
fffffOption: C

C. The code reads the password without echoing characters on the console. tested

SigamaniOption: C

C is correct

jduarteOption: C

Answer C. Tested

OhayouOption: C

Answer is : C

petetsaiOption: C

C tested, on windows 10 CMD.

asdfjhfgjuaDCVOption: C

C is the correct answer

steefaandOption: C

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.

iSnoverOption: C

C. The code reads the password without echoing characters on the console. tested

push05Option: C

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

Kim514Option: C

Answer is : C

Eason_from_the_futureOption: A

Answer is A. Exception in thread "main" java.lang.NullPointerException

vancuver

This is a bug #122429 of eclipse

Manuel7000Option: A

Answer is A.

pul26Option: D

Answer is D tested