Open In App

ObjectInputStream readBoolean() method in Java with examples

Last Updated : 28 May, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
The readBoolean() method of the ObjectInputStream class in Java reads a boolean from the stream. Syntax:
public boolean readBoolean()
Parameters: This method does not accept any parameter. Return Value: This method returns the boolean that has been read. Errors and Exceptions: The function throws two exceptions which is described below:
  • EOFException: The function is thrown if the end of file is reached.
  • IOException: The function is thrown if an I/O error has occurred.
Below program illustrate the above method: Program 1:
Output: Reference: https://docs.oracle.com/javase/10/docs/api/java/io/ObjectInputStream.html#readBoolean()

Similar Reads