首页 > 代码库 > java 字节流和字符流转换类InputStreamReader,OutPutStreamReader

java 字节流和字符流转换类InputStreamReader,OutPutStreamReader



import java.io.*;

public class BufferDemo
{
	public static void main(String[] args) throws IOException
	{
		BufferedReader buf=null;
		
		buf=new BufferedReader(new InputStreamReader(System.in));
		System.out.print("Please enter a number:");
		String str=buf.readLine();
		//将字符串解析为整数
		int i=Integer.parseInt(str);
		i=i+10;
		System.out.println("The modified number is "+i+".");
	}
}