集册 Java实例教程 使用DataInputStream从文件中读取布尔值

使用DataInputStream从文件中读取布尔值

欢马劈雪     最近更新时间:2020-01-02 10:19:05

420
使用DataInputStream从文件中读取布尔值
// from 时 代 J a v a 公 众 号 - nowjava.com

import java.io.DataInputStream;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.IOException;

 

public class Main {

 

  public static void main(String[] args) {

 

    String strFilePath = "C://Folder//readBoolean.txt";

   

    try

    {

       FileInputStream fin = new FileInputStream(strFilePath);

       DataInputStream din = new DataInputStream(fin);//from n o w j a v a . c o m - 时代Java

       boolean b = din.readBoolean();

       System.out.println("boolean : " + b);

       din.close();

    }

    catch(FileNotFoundException fe)

    {

      System.out.println(
展开阅读全文