但开发的时侯得用这种要用try-catch
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class Test
- {
- public static void main(String[] args)
- {
- BufferedReader br = null;
- try
- {
- br = new BufferedReader(new InputStreamReader(System.in));
- System.out.println(br.readLine());
- }
- catch(IOException e)
- {
- System.out.println(e);
- }
- finally
- {
- try
- {
- if(br != null)
- br.close();
- }
- catch(IOException e)
- {
- System.out.println(e);
- }
- }
- }
- }
复制代码 还有什么问题吗? |