Как остановить оставшееся время, пока игра не закончилась?

Если это действительно то, что вы делаете в своем коде lot , то вы можете ввести расширение концепции signum с помощью enum.

/**
 * Extends the signum function to multiple arguments
 * <p>
 * If all signums are the same then that will be returned.
 * <p>
 * If any are different - return Mixed.
 */
enum Sign {
    Negative, Positive, Zero, Mixed;

    public static Sign get(int n) {
        return n < 0 ? Negative : n == 0 ? Zero : Positive;
    }

    public static Sign get(int... n) {
        Sign first = get(n[0]);
        for(int i = 1; i < n.length; i++) {
            if(get(n[i]) != first) {
                return Mixed;
            }
        }
        return first;
    }
}

Используйте его как:

Sign.get(arg1, arg2, arg3) == Sign.Positive
0
задан Hovercraft Full Of Eels 19 January 2019 в 13:40
поделиться

1 ответ

Вы должны открыть «mytimer» как глобальную переменную. И следует написать: -

if (count == 3 && myAnswer != number)
{
    System.out.println("You've reached the maximum trys. Goodbye!");
    mytimer.cancel();
}

Работал на меня !!

Надежда поможет.

0
ответ дан GameChanger 19 January 2019 в 13:40
поделиться
Другие вопросы по тегам:

Похожие вопросы: