I have a text file that is in the project directory. In it, separated by a dot, are groups of professions. for example
Programmer: Web Designer: System Administrator. Biologist: Pharmacist: Chemistry Teacher.
My task is to fill the String array with groups of these professions. Points are the separators of the elements of the array. In my example, there would be an array of two elements.
There are 100 such groups in my file. I need to add all these groups to the array of size [10] [10] so that after each element of a multiple of 10, the cycle moves to the next line, respectively.
My code (non-working)
public static void main(String[] args) throws FileNotFoundException { String[][] array = new String[10][10]; try (BufferedReader br = new BufferedReader( new FileReader("C:\\Users\\Alexey\\eclipse-workspace\\Plugin\\src\\MatProList.txt"))) { for (int i = 0; i < 10; i++) { for (int c = 0; c < 10; c++) { while ((char)br.read() != '.') { array[i][c] = array[i][c] + (char)br.read(); } } if (br.read() == -1) { break; } } } catch (IOException ex) { System.out.println(ex.getMessage()); } } Please help me find my mistake.