IO编程之-演示FileOutputStream类的用法
发布日期:2021-05-12 19:32:34 浏览次数:13 分类:精选文章

本文共 536 字,大约阅读时间需要 1 分钟。

package com.io2;

import java.io.*;import java.util.Scanner;

public class iotest {

public static void main(String[] args) {    File f = new File("e:\\bb.txt");    FileOutputStream fos = null;    try {        fos = new FileOutputStream(f);              Scanner sc = new Scanner(System.in);        @SuppressWarnings("unchecked")        String input = sc.nextLine();                fos.write(input.getBytes());            } catch (Exception e) {        e.printStackTrace();    } catch (IOException e2) {        e2.printStackTrace();    }}

}

上一篇:数组练习---------往数组里面添加元素
下一篇:IO编程之-演示FileInputStream类的使用

发表评论

最新留言

感谢大佬
[***.8.128.20]2025年04月13日 17时43分27秒