A right
a text-output stream.
automatic flushing is enabled
B. fail
it can have registered shutdown hooks (threads)
C password is not encrypted it just suppresses echoing, so the password is not visible on the user's screen.
D. Fail
a text-output stream.
A. PrintWriter: It is used for writing text data to a character stream. It automatically flushes the stream after writing, ensuring that the data is immediately sent to the output destination.
PrintWriter has methods that allow character output. Additionally, PrintWriter has an option for auto-flushing that can be enabled in the builder. When enabled, certain write and println methods will automatically flush the output buffer.
The correct answer is A. PrintWriter outputs characters and automatically flushes the stream. Explanation: A. PrintWriter is a class in Java that outputs characters to an output stream and automatically flushes the stream when a newline character is written, when the println method is invoked, or when a carriage return character is written. B. System.exit() does not invoke the close() method for the InputStream/OutputStream resources. It terminates the currently running Java Virtual Machine (JVM). It's the responsibility of your code to close streams before exiting. C. Console.readPassword() does not encrypt the text entered. It simply disables echoing, so the password is not displayed on the console when it's entered. D. PrintStream does not output only bytes. It can output all primitive data types and strings using its print and println methods.
I would vote for D. Because it is fact: "All characters printed by a PrintStream are converted into bytes using the platform's default character encoding."
As regards A: "... if automatic flushing is enabled ..." so it is not true always. B is not true. So I vote for C - Tested (https://www.geeksforgeeks.org/console-readpassword-method-in-java-with-examples/).
I find this a rather tricky one because and would like to know the answer.
So what I found is that a PrintWriter doesn't automatically flushes the stream, it does however have a constructor accepting a boolean to ENABLE autoflushing..
for D.. I found this in the oracle docs: All characters printed by a PrintStream are converted into bytes using the platform's default character encoding. The PrintWriter class should be used in situations that require writing characters rather than bytes.
So it's either A or D
It has a constructor that can take an OutputStream as an argument, and an optional second argument that specifies whether the stream should be automatically flushed when println is called. This means that the data is immediately written to the underlying output stream, instead of being buffered.
This section is not available anymore. Please use the main Exam Page.1z0-819 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
ASPushkin
6 months agocathDev
7 months agod7bb0b2
10 months, 1 week agod7bb0b2
11 months, 1 week agoOmnisumem
1 year, 1 month agoOmnisumem
1 year, 1 month ago[Removed]
1 year, 2 months ago[Removed]
1 year, 2 months agoStavok
1 year, 3 months agobelal97
1 year, 4 months ago