package lab6; import java.io.*; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Zad2 { static Scanner scanner = null; static int[][] arr = new int[10][10]; static String[] s = new String[10]; static List slist = new ArrayList(); static String str2 = null; public static void main(String[] args) { // open(); openLines(); show(); } static void open() { Path filePath = Paths.get("calculator_data.txt"); String str = null; int x = 0; try { scanner = new Scanner(filePath); str2 = scanner.nextLine(); scanner.reset(); scanner = new Scanner(filePath); while (scanner.hasNext()) { str = scanner.next(); if (!(x > 1 && (str.charAt(0) == '+' || str.charAt(0) == '-' || str.charAt(0) == '*' || str.charAt(0) == '/'))) { s[x] = str; x++; } } } catch (IOException e) { System.out.println("IOException!!!!!!!!"); } } static void openLines() { Path filePath = Paths.get("calculator_data.txt"); String str; // int x = 0; try { scanner = new Scanner(filePath); while (scanner.hasNext()) { str = scanner.nextLine(); // s[x] = str; slist.add(str); // x++; } } catch (IOException e) { System.out.println("IOException!!!!!!!!"); } } static void show() { // for (int i = 0; i < s.length; i++) { // if (s[i] != null) // System.out.println(s[i]); // } slist.forEach(System.out::println); // System.out.println(str2); } }