Page 1 of 1

About Question enthuware.ocpjp.ii.v11.2.1812 :

Posted: Mon Jan 27, 2020 11:29 am
by kevvvvyp
"java.lang.System
public static Console console()
Returns the unique Console object associated with the current Java virtual machine, if any."

The answer to this question is implementation specific for example when run on my machine accessing c.readPassword will throw a NPE.

Proposed rewording: What will happen when this code is compiled and run from the command line (assume that there is a unique Console object associated with the Java virtual machine)

Re: About Question enthuware.ocpjp.ii.v11.2.1812 :

Posted: Mon Jan 27, 2020 12:43 pm
by admin
The problem statement says that the program is run from the command line, so, there is a Console.