私の英語については申し訳
ありません:) Javaプログラミングは初めてで、スキャナーに問題があります。Int を読み取り、いくつかのものを表示してから文字列を読み取る必要があるため、sc.nextInt();を使用します。自分のものを表示 showMenu(); 次に、文字列palabra=sc.nextLine();を読み取ろうとします。
sc.nextLine(); を使用する必要があると言われました。sc.nextInt(); の後 しかし、なぜあなたがそれをしなければならないのか分かりません:(
これが私のコードです:
public static void main(String[] args) {
// TODO code application logic here
Scanner sc = new Scanner(System.in);
int respuesta = 1;
showMenu();
respuesta = sc.nextInt();
sc.nextLine(); //Why is this line necessary for second scan to work?
switch (respuesta){
case 1:
System.out.println("=== Palindromo ===");
String palabra = sc.nextLine();
if (esPalindromo(palabra) == true)
System.out.println("Es Palindromo");
else
System.out.println("No es Palindromo");
break;
}
}
あなたの時間と助けにとても感謝しています:D