Given the code fragment:
Which code at line n1, obtains the java.io.Console object?
Given the code fragment:
Which code at line n1, obtains the java.io.Console object?
The correct way to obtain a java.io.Console object is by using the System.console() method. This method returns the unique Console object associated with the current Java virtual machine, if any. None of the other options correctly initialize or obtain a Console object. Therefore, the correct choice is: Console console = System.console();
B is correct
B is right answer