[学习笔记]

1.2 PrintWriter的用法

PrintWriter和PrintStream类似,只不过PrintStream是针对字节流的,而PrintWriter是针对字符流的。

例:1.2.1
import java.io.*;
public class TestMark_to_win {
public static void main(String args[]) throws Exception {
String s1 = "我们" + "\n";
String s2 = "你们" + "\n";
PrintWriter p = new PrintWriter("c:/out.txt");
p.println("output" + s1);
p.println("output" + s2);
/*without using the following statement, the file name can be write out, but the content of the file is empty. */
p.close();
}
}

文章转载自原文:https://blog.csdn.net/mark_to_win/article/details/71023774

最新文章

  1. Windows进程崩溃问题定位方法
  2. java多线程-线程通信
  3. Linux 下安装pip
  4. 传智播客JavaWeb day03
  5. 接口自动化之Postman+Newman
  6. 启动图实现:UIScrollView+UIPageControl简单实现
  7. Call to undefined function bcscale()
  8. oracle学习 六 删除表空间,数据文件的语句以及导入导出dmp文件的方法(持续更新中)
  9. Server Error The server encountered an error and could not complete your request. 新建站点模版失败
  10. 【POJ2406】 Power Strings (KMP)
  11. 【原创】javascript——事件思维导图
  12. SpringNote01.基于SpringMVC-Hibernate的Blog系统
  13. ThinkPhp知识大全(非常详细)
  14. js实现省市区三级联动
  15. 利用Fiddler修改请求信息通过Web API执行操作(Action)实例
  16. JS中的函数和BOM
  17. [原创]Xilinx Vivado 2017.4/2018.3/2016.4/2015.4/ISE14.7下载及其安装
  18. hadoop2.6.0高可靠及yarn 高可靠搭建
  19. js点滴
  20. [转]wxParse-微信小程序富文本解析组件

热门文章

  1. 8月清北学堂培训 Day6
  2. gitlab 配置.ssh实现免密登陆
  3. Ubuntu14.04(indigo)实现RGBDSLAMv2(数据集和实时Kinect)
  4. dpkg 删除 百度网盘 程序
  5. Java排序之计数排序
  6. JMeter压力测试及并发量计算-2
  7. mysql —日志记录
  8. Hive-概述
  9. Methods for Identifying Out-of-Trend Results in Ongoing Stability Data
  10. numpy中flatten学习笔记