fileapp.java

来自「针对越来越多的用户喜欢JAVA」· Java 代码 · 共 29 行

JAVA
29
字号
import java.io.*;
class SaveFile
{
  private char ch;
  private int i='a'-'A';
  void save()
  {
    System.out.println("请输入一个字符串:");
    try {
      FileOutputStream out= new FileOutputStream("a.txt");
      while((ch=(char)System.in.read())!='#')
      {
        if(ch>='a'&&ch<= 'z' )
           ch= (char)((int)ch-i);
        out.write(ch);
      }
       out.close();
     } catch(IOException e){ };
  }
}
public class FileApp
{
  public static void main(String[ ] args)
  {
    SaveFile f= new SaveFile();
    f. save();
  }
}

⌨️ 快捷键说明

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