![](https://cdn.javarush.com/images/article/154f67b7-72d7-497c-863b-6bf0b4cc5bce/1024.jpeg)
package com.javarush.task.pro.task14.task1406;
import java.util.Scanner;
/*
Купи слона
*/
class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
buyElephant(null, scanner);
}
static void buyElephant(String answer, Scanner scanner) {
if (answer == null) {
System.out.println("Купи слона");
} else if (answer.toLowerCase().equals("ок")) {
System.out.println("Так-то лучше :) Список твоих отговорок:");
throw new SecurityException();
} else {
System.out.println("Все говорят \"" + answer + "\", а ты купи слона");
}
answer = scanner.nextLine();
try {
buyElephant(answer, scanner);
} catch (Exception e) {
System.out.println(answer);
throw e;//напишите тут ваш код
}
}
}