DataInputStream ReadBoolean() Example
returns the boolean value read
DataInputStreamclass ReadBoolean() method example. This example shows you how to use ReadBoolean() method.This method returns the boolean value read
Here is the code:-
/**
* @Program that returns the boolean value read.
* ReadBoolean.java
* Author:-RoseIndia Team
* Date:-07-jun-2008
*/
import java.io.*;
public class ReadBoolean {
public static void main(String[] args)throws IOException {
boolean eE=false;
FileOutputStream fos = new FileOutputStream("Linux.txt");
DataOutputStream dos = new DataOutputStream(fos);
dos.writeBoolean(eE);
dos.flush();
dos.close();
FileInputStream fis = new FileInputStream("Linux.txt");
DataInputStream dis = new DataInputStream(fis);
//returns the boolean value read.
boolean e=dis.readBoolean();
System.out.println(e);
}
} |
|