package JBJADV003;
import java.io.*;
public class ReOut {

/**
* @param args
*/
public static void main(String[] args) {
PrintStream ps=null;
try{
//创建PrintStream输出流
ps=new PrintStream(new FileOutputStream("c:\\myDoc\\hello.txt"));
//重定向到文件
System.setOut(ps);
//向文件print内容
System.out.print("我的测试,重定向到文件hello!");
System.out.println(new ReOut());
}catch(IOException ex){

}finally{
if(ps!=null){
ps.close();
}
}
}
}

ReOut的更多相关文章

  1. 越狱Season 1-Episode 19: The Key

    Season 1, Episode 19: The Key -Kellerman: WeusedtohaveaGreatDane, Dane: 丹麦大狗 我们以前有一只大丹犬 bigandwild. ...

  2. Java读写记事本文件

    Java中我们也会考虑读写记事本,文件读取如下: public static void main(String[] args) { try { String path="d:\\abc.tx ...

  3. Java从零开始学三十八(JAVA IO- 重定向IO)

    一.三个静态变量 java.lang.System提供了三个静态变量 System.in(默认键盘) System.out(默认显示器) System.err 二.重写向方法 System提供了三个重 ...

随机推荐

  1. 将C-风格字符串用作string对象引用参数

    string类定义了一种char*到string的转换功能,这使得可以使用C-风格字符串来初始化string对象. 类型为const引用的形参其中一个属性表明:假设实参的参数类型与引用参数不匹配,但可 ...

  2. Word Ladder 2015年6月3日

    Given two words (beginWord and endWord), and a dictionary, find the length of shortest transformatio ...

  3. rowid去重(删除表的重复记录)

    -- 构造测试环境SQL> create table andy(id int,name varchar2(10));Table created.SQL>insert into andy v ...

  4. Python字符处理

    字符串就是一系列字符.在python中,用引号括起来的都是字符串,这里的引号可以是单引号也可以双引号. 例如: >>> 'this is a string' 'this is a s ...

  5. An Introduction to Stock Market Data Analysis with R (Part 1)

    Around September of 2016 I wrote two articles on using Python for accessing, visualizing, and evalua ...

  6. Customer segmentation – LifeCycle Grids with R(转)

    I want to share a very powerful approach for customer segmentation in this post. It is based on cust ...

  7. centos6.5 ssh免密码登陆

    ssh-keygen -t rsa ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop1

  8. 2016.02.01日,UdoOS系统项目正式开通了

    2016.02.01日,UdoOS系统项目正式开通了,源代码即将开放 Copyright (c) 2016

  9. nodeJS之fs文件系统

    前面的话 fs文件系统用于对系统文件及目录进行读写操作,本文将详细介绍js文件系统 概述 文件 I/O 是由简单封装的标准 POSIX 函数提供的. 通过 require('fs') 使用该模块. 所 ...

  10. 读Zepto源码之操作DOM

    这篇依然是跟 dom 相关的方法,侧重点是操作 dom 的方法. 读Zepto源码系列文章已经放到了github上,欢迎star: reading-zepto 源码版本 本文阅读的源码为 zepto1 ...