Given the code fragment:
public class DisplaValues {
public void printNums (int [] nums){
for (int number: nums) {
System.err.println(number);
}
}
}
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 codecompilesfine.
The code runs fine.
The err stream 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” error output 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 host environment or user. By convention, this output stream is used to display error messages or other information that should come to the immediate attention of a user even if the principal output stream, the value of the variable out, has been redirected to a file or other destination that is typically not continuously monitored.Reference:java.lang.System
D Standard error is mapped to another destination.