Which of the following classes is used to write characters to a file in Java?
- BufferedReader
- FileOutputStream
- FileWriter
- PrintWriter
The FileWriter class in Java is used to write characters to a file. It provides methods to write character data to a file in a character stream. FileOutputStream is used for writing binary data, PrintWriter is used for formatted text output, and BufferedReader is used for reading character data, not writing.
Loading...
Related Quiz
- Consider a scenario where an application retrieves a large amount of data from a database and displays it in a UI paginated form. How would you efficiently manage and optimize data retrieval and display using JDBC?
- Imagine you are working on a system that heavily utilizes serialization. How would you manage a scenario where sensitive data, such as passwords, should not be serialized?
- When using PrintWriter, the method ________ can be used to flush the stream and check its error state.
- Which of the following concepts allows Java objects to be initialized with actual data when they are created?
- Which of the following operators will determine whether two values are not equal?