zoukankan      html  css  js  c++  java
  • 输出流2

    11.15

    今天练习了输出流的相关知识;

    代码部分:

    package lianxi;
    import java.io.*;
    public class bo
    {
    public static void main(String[] args) throws IOException {
    FileWriter fw = null;
    try {
    //创建字符输出流
    fw = new FileWriter("D://c.txt");
    fw.write("锦瑟 - 李商隐 ");
    fw.write("锦瑟无端五十弦,一弦一柱思华年。 ");
    fw.write("庄生晓梦迷蝴蝶,望帝春心托杜鹃。 ");
    fw.write("沧海月明珠有泪,蓝田日暖玉生烟。 ");
    fw.write("此情可待成追忆,只是当时已惘然。 ");
    } catch (IOException ioe) {
    ioe.printStackTrace();
    } finally {
    //使用finally块来关闭文件输出流
    if (fw != null) {
    fw.close();
    }
    }
    }
    }

     运行结果:

     运行结果分析:

    成功的吧李商隐的锦瑟输入到c文件 里面;

  • 相关阅读:
    makefile 3
    makefile 3
    wzplayer for delphi demo截图
    makefile 2
    makefile
    wzplayer for delphi demo截图
    clang complete
    makefile
    clang complete
    linux最常用命令集合
  • 原文地址:https://www.cnblogs.com/092e/p/14148262.html
Copyright © 2011-2022 走看看