集册 Java实例教程 使用DataInputStream读取文件中的float

使用DataInputStream读取文件中的float

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

527
使用DataInputStream读取文件中的float

/**
nowjava
**/

 

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//readFloat.txt";

   

    try

    {

      FileInputStream fin = new FileInputStream(strFilePath);

      DataInputStream din = new DataInputStream(fin);

      float f = din.readFloat();

      System.out.println("float : " + f);

      din.close();
      /** 
       来自 NowJava.com - 时  代  Java**/

    } catch(FileNotFoundException fe){

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