怎样 从“D:\test.txt”中读入所有字符,并将其内容从头到尾反过来输出在屏幕上啊啊啊,求大神指教

import java.io.*;

  public class E7_1{

          public static void main(String args[ ]){

       int b;

       try {

          FileInputStream fis=new FileInputStream("D:\\test.txt");

             while ( (b= fis.read()) !=-1)

              System.out.print((char)b);

             fis.close();

       }

                   catch (Exception e) {

             system.out.println("出错了,原因是:");

             system.out.println (e.toString());

                }

         }

  }


慕粉3214452
浏览 2391回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java