Which statements describe a java.io stream class and cannot be applied to a java.util.stream.Stream class? (Choose three.)
flush()
method.A, B, D.
Option A is correct because the java.io stream classes implement Closeable and can be used with try-with-resources statements, while java.util.stream.Stream does not implement Closeable.
Option B is correct since the Reader/Writer classes are used for handling character data.
There are primitive stream classes in java.util.stream, but none for handling character data, such as CharStream
.
Option C is incorrect because neither requires all data objects to implement Serializable.
Option D is correct since flush()
is found in Writer and OutputStream but not in any of the java.util.stream classes.
Option E is incorrect since both types of streams contain a skip()
method in some of their classes.
Lastly, Option F is incorrect.
There is no sort method found in any of the java.io classes.
While there is a sorted()
method in java.util.stream.Stream, the question is asking about what features are available in a java.io stream class and not in a java.util.stream.Stream class.