Home » Java ObjectInputStream readBoolean() Method with Examples

Java ObjectInputStream readBoolean() Method with Examples

by Online Tutorials Library

Java ObjectInputStream readBoolean() Method

The readBoolean() method of the java.io.ObjectInputStream class is used to read the data of Boolean type. It returns true if the byte is non zero, false if the byte is zero.

Syntax

Parameter

No parameter is passed.

Returns

true/false.

Throws

EOFException – If the end of file is reached.

IOException – If other I/O error has occurred.

Example 1

Output:

Hello TutorAspire byte is non Zero  

Example 2

Output:

Hello TutorAspire byte is  Zero  

You may also like