0

while (!stdin.hasNextInt()) を使用して、入力された値が数値であることを確認しています。

while (!stdin.hasNextInt())
        {
            stdin.nextLine();
            System.out.println("It must be a numeric value, re-enter: ");
        }
        side_1 =stdin.nextInt();

ここで、その数値が > 0 であるかどうかも確認する必要があります。とにかく同じ while 条件で取得できるものはありますか?

ありがとう!

4

0 に答える 0