_118_Java_标准输入输出流

----------------------------------

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.junit.Test;

public class _001_StandardInputOrOutputStream {
	
	@Test
	public void test() {
		InputStream in = System.in;
		InputStreamReader isr= new InputStreamReader(in);
		BufferedReader br = new BufferedReader(isr);
		try {
			String readLine = br.readLine();
			System.out.println(readLine);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally {
			if(br!=null) {
				try {
					br.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}
		
		
		
	}
	
}

猜你喜欢

转载自blog.csdn.net/poiuyppp/article/details/82827923