About Question enthuware.ocpjp.ii.v11.2.1812 :
Posted: Mon Jan 27, 2020 11:29 am
"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)
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)