相关文章推荐
豪爽的花生  ·  java date ...·  10 月前    · 
大鼻子的荒野  ·  jpanel设置大小-掘金·  2 年前    · 
public static void main (String[] args) { try { FileInputStream in = new FileInputStream ( "example.dat" ); int c; while ((c = in.read()) != - 1 ) { System.out.print(( char )c); in.close(); } catch (Exception e) { System.out.println( "Error reading file" );

上面的代码使用了 FileInputStream 类来读取 .dat 文件,并通过循环读取文件中的数据,最后打印出来。

  •