debug8_1.java

来自「程序练习中包括书中实例程序代码和练习中要用到的代码,是压缩文件」· Java 代码 · 共 33 行

JAVA
33
字号
package questions.c8;
import java.io.*;
public class Debug8_1 {
   public static void main( String[] args )
         throws IOException {
      InputStream  input;
      OutputStream output;
      if ( args.length >= 2 ) {
         input = new FileInputStream( args[0] );
         output = new FileOutputStream( args[1] );
      } else {
         input = System.in;
         output = System.out;
      }
      int c;
      try {
         while ( ( c = input.read() ) != -1 ) {
            // change blanks to underscores
            if ( c == ' ' ) {
               c = '_';
            }
            output.write( c );
         }
      }
      catch( IOException iox ) {
         System.out.println( iox );
      }
      finally {
         input.close();
         output.close();
      }
   }
}

⌨️ 快捷键说明

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