public static void main(String[] args) throws IOException {
        while (true) {
            System.out.println("Choose option for HomeWork to be done with...\n 1 - BufferedReader\n 2 - Scanner\n 3 - JOptionPane\n 4 - Exit");
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
            int number = 0;
            while (number < 1 || number > 4) {
                System.out.println("You can enter ONLY '1', '2', '3' or '4'.");
                try {
                    number = Integer.parseInt(bufferedReader.readLine());
                } catch (NumberFormatException ignore) {
                }
            }
            switch (number) {
                case 1:
                    System.out.println("Please, enter your name for BufferedReader...");
                    String name = bufferedReader.readLine();
                    System.out.println("Hello, " + name + "! It's BufferedReader!\n");
                    break;
                case 2:
                    System.out.println("Please, enter your name for Scanner...");
                    Scanner scanner = new Scanner(System.in);
                    String scannerName = scanner.nextLine();
                    System.out.println("Hello, " + scannerName + "! It's Scanner!\n");
                    break;
                case 3:
                    String ask = JOptionPane.showInputDialog("Please, enter your name for JOptionPane...");
                    JOptionPane.showMessageDialog(null, "Hello, " + ask + "! It's JOptionPane!\n");
                    break;
                case 4:
                    bufferedReader.close();
                    System.exit(0);
                    break;
            }
        }
    }