Why is this method not producing output on the console?

Given the code fragment:

Assume the method printNums is passed a valid array containing data. Why is this method not
producing output on the console?

Given the code fragment:

Assume the method printNums is passed a valid array containing data. Why is this method not
producing output on the console?

A.
There is a compilation error.

B.
There is a runtime exception.

C.
The variable number is not initialized.

D.
Standard error is mapped to another destination.

Explanation:

The code compiles fine.
The code runs fine.
The errorstream can be redirected.
Note:
System.out.println -> Sends the output to a standard output stream. Generally monitor.
System.err.println -> Sends the output to a standard error stream. Generally monitor. err is the
“standard” erroroutput stream. This stream is already open and ready to accept output data.
Typically this stream corresponds to display output or another output destination specified by the
hostenvironment or user. By convention, this output stream is used to display error messages or
other informationthat should come to the immediate attention of a user even if the principal output
stream, the value of thevariable out, has been redirected to a file or other destination that is
typically not continuously monitored.
Reference:java.lang.System



Leave a Reply 1

Your email address will not be published. Required fields are marked *


jalex

jalex

Answer is D