SHARE
TWEET

Untitled

a guest Sep 20th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.javarush.task.task18.task1824;
  2.  
  3. /*
  4. Файлы и исключения
  5. */
  6.  
  7. import java.io.*;
  8.  
  9. public class Solution {
  10.     public static void main(String[] args) {
  11.         BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  12.         String filename = "";
  13.         while (true) {
  14.             try {
  15.                 filename = reader.readLine();
  16.                 FileReader fileReader = new FileReader(filename);
  17.                 fileReader.close();
  18.             } catch (FileNotFoundException e) {
  19.                 System.out.println(filename);
  20.                 break;
  21.             } catch (IOException e) {
  22.                 e.printStackTrace();
  23.             }
  24.         }
  25.  
  26.         try {
  27.             reader.close();
  28.         } catch (IOException e) {
  29.             e.printStackTrace();
  30.         }
  31.  
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top