我正在尝试编写一个 If 或 If-Else 语句,以在提示时未输入整数值时保护程序。我不断收到错误消息:预期为“.class”。
System.out.println("Type the name of your destination: ");
destination = keyboard.nextLine();
System.out.print(destination + " is how many miles away?");
miles = keyboard.nextInt();
if (miles != int);
{
System.out.println(miles + " is not valid. I will use 100 for the number of miles.");
}