Advertisement
Guest User

Untitled

a guest
Mar 17th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. package ru.pa4ok.it1;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.File;
  5. import java.io.FileReader;
  6. import java.io.IOException;
  7.  
  8. public class it1
  9. {
  10.     private static char[][] ch;
  11.     private static int kol = 0;
  12.    
  13.     public static void main(String[] args)
  14.     {
  15.         BufferedReader reader = null;
  16.         try
  17.         {
  18.             reader = new BufferedReader(new FileReader(new File("C://it/it1/s1.txt")));
  19.             String c;
  20.            
  21.             while ((c = reader.readLine()) != null)
  22.             {
  23.                 ch[kol] = c.toCharArray();
  24.                 kol = kol + 1;
  25.             }
  26.             reader.close();
  27.         }
  28.         catch (IOException e)
  29.         {
  30.             e.printStackTrace();
  31.         }
  32.         finally
  33.         {
  34.             if (reader != null)
  35.             {
  36.                 try
  37.                 {
  38.                     reader.close();
  39.                 }
  40.                 catch (IOException e)
  41.                 {
  42.                     e.printStackTrace();
  43.                 }
  44.             }
  45.         }
  46.        
  47.         for (int i=0; i<ch.length; i++)
  48.         {
  49.             for (int j=0; j<ch[i].length; j++)
  50.             {
  51.                 System.out.print(ch[i][j] + " ");
  52.             }
  53.             System.out.println();
  54.         }
  55.     }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement