分類  >  編程 >

java 位元組流跟字元流轉換類InputStreamReader,OutPutStreamReader

tags:    時間:2014-05-04 18:39:08
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+"."); 	} }


推薦閱讀文章

Bookmark the permalink ,來源:互聯網