本帖最后由 清心玉质 于 2013-8-9 18:14 编辑
package IOtest;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
/**
* @author Administrator
*
*/
public class BufferedDemo {
/**
* @param args
* 从键盘录入数据,并在控制台大写输出
* 键盘:System.in
* 控制台:System.out
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
InputStream is = System.in;
InputStreamReader isr = new InputStreamReader(is);
BufferedReader bur = new BufferedReader(isr);
OutputStream os =System.out;
OutputStreamWriter osw = new OutputStreamWriter(os);
BufferedWriter buw = new BufferedWriter(osw);
String line =null;
while((line=bur.readLine())!=null)
{
if("over".equals(line))
break;
buw.write(line.toUpperCase());
buw.newLine();
}
bur.close();
}
} |
|