?? chap7-6.txt
字號(hào):
// 程序7-6
import java.io.*;
public class testThrows {
public static String readString( ) throws IOException{ // 當(dāng)前方法可能產(chǎn)生異常
int ch;
String r="";
boolean done=false;
while(!done){
ch=System.in.read( );
if(ch<0 || ch==0xd) // 處理回車(chē)符中的第一個(gè)符號(hào)
done=true;
else
r=r+(char)ch;
}
return r;
}
public static void main(String args[ ]) {
String str;
try{
str=readString( );
}catch(IOException e){ // 處理異常
System.out.println("產(chǎn)生了輸入/輸出異常");
return;
}
System.out.println("輸入的整數(shù)是:"+Integer.parseInt(str));
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -