⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 例五.txt

📁 这是一本java基础教程 对新手上路有很大帮助
💻 TXT
字号:
import java.io.*;
public class Example9_5{
    public static void main(String args[ ]){
        File readFile=new File("Student.txt"),
        writeFile=new File("Hello.txt");
        try{  FileReader inOne=new FileReader("Student.txt");
             BufferedReader inTwo= new BufferedReader(inOne);
             FileWriter tofile=new FileWriter("hello.txt");
             BufferedWriter out= new BufferedWriter(tofile);
             String s=null;
             int i=0;
             while((s=inTwo.readLine())!=null){
                 i++;
                 out.write(i+" "+s);
                 out.newLine();
             }
             out.flush();
             out.close();
             tofile.close();
             inOne=new FileReader("hello.txt");
             inTwo= new BufferedReader(inOne);
             while((s=inTwo.readLine())!=null){
                System.out.println(s);
             } 
             inOne.close();
             inTwo.close();
        }
        catch(IOException e){
             System.out.println(e);
        }  
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -