1Z0-804 · Question #108
Given the code fragment: Assume the method printNums is passed a valid array containing data. Why is this method not producingoutput on the console?
The correct answer is D. Standard error is mapped to another destination. The code compiles fine. The code runs fine. The errorstream can be redirected. 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"…
Question
Given the code fragment:
Assume the method printNums is passed a valid array containing data. Why is this method not producingoutput on the console?
Options
- AThere is a compilation error.
- BThere is a runtime exception.
- CThe variable number is not initialized.
- DStandard error is mapped to another destination.
How the community answered
(37 responses)- A11% (4)
- B5% (2)
- C3% (1)
- D81% (30)
Explanation
The code compiles fine. The code runs fine. The errorstream can be redirected. 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.
Topics
Community Discussion
No community discussion yet for this question.