Input a line of characters and save it to the file line Txt

From , 5 Years ago, written in Java, viewed 99 times.
URL https://pastebin.vip/view/0f966132
  1. import java.io.*;
  2.  
  3. /**
  4.  * 输入一行字符,存入到文件 line.txt中
  5.  */
  6. public class Example10_5 {
  7.         public static void main(String args[]) {
  8.                 int b;
  9.                 byte buffer[] = new byte[100];
  10.                 try {
  11.                         System.out.println("输入一行文本,并存入磁盘:");
  12.                         b = System.in.read(buffer);
  13.                         FileOutputStream writefile = new FileOutputStream("line.txt");
  14.                         writefile.write(buffer, 0, b);
  15.                 } catch (IOException e) {
  16.                         System.out.println("Error" + e);
  17.                 }
  18.         }
  19. }
  20.  

Reply to "Input a line of characters and save it to the file line Txt"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website