はじめての記事です。気合いれましょう。シャオラ。 【現象】nextInt()のあとにnextLine()を書くとスキップされる ①例えばこのようなコードがあるとします。(Scannerクラスは”scanner”としてimportしてある状態) System.out.println("あなたの名前を入力してください。
プログラミングを学ぶうえで、最初に取り組みやすい題材が「じゃんけんゲーム」です。 プレイヤーとコンピュータが「グー」「チョキ」「パー」を出し合い、勝敗を判定します。 この題材では、条件分岐(if文)、乱数(Randomクラス)、入力処理(Scanner ...
Fixed the comment to say that 0 is the issue, not a negative number. nextInt doesn't allow 0 to be passed, and since the filtered stream above yields 0 elements, this seems to cause the crash.