集册 Java实例教程 使用DataInputStream从文件读取双精度

使用DataInputStream从文件读取双精度

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

407
使用DataInputStream从文件读取双精度
/* 
 来自 
*N o w J a v a . c o m - 时  代  Java*/


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

   

    try{

      FileInputStream fin = new FileInputStream(strFilePath);

     

      DataInputStream din = new DataInputStream(fin);

     

      double d = din.readDouble();

       

      System.out.println("Double : " + d);//时 代 J a v a - nowjava.com 提供

       

      din.close();

       

    }

    catch(FileNotFoundException fe)

    {

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