j_example.java

来自「一个十分好的java基础学习的课件」· Java 代码 · 共 39 行

JAVA
39
字号
// ////////////////////////////////////////////////////////
// 
// J_Example.java
// 

// ////////////////////////////////////////////////////////

import java.io.*; 

public class J_Example
{

    public static void main(String args[])
    {
        String s;
        try
        {
            BufferedReader fs =new BufferedReader(new FileReader("test.txt"));
            PrintWriter fd =new PrintWriter(new FileWriter("out.txt"));

            s= fs.readLine( );
            while( s!= null )
            {
                System.out.println(s);
                fd.println(s);
                s= fs.readLine( );
            }// End of loop: while.

            fs.close( );
            fd.close( );
        }
        catch(Exception e)
        {
            System.out.println(e);
        } // End of try/catch structure.
    } // End of method: main

} // End of class: J_Example

⌨️ 快捷键说明

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