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+"."); } }
java 字节流和字符流转换类InputStreamReader,OutPutStreamReader,布布扣,bubuko.com
时间: 2024-10-12 14:07:16