この時点で何が間違っているのかよくわからない。同じ2つのエラーを受け取り続ける:不正な構文解析エラー
CoffeeBot.java:79:表現
}
CoffeeBot.java:82の違法開始:私は、同じ2つのエラーを取得してきたファイルの終わりに達しを
を解析中} //パブリッククラス
2エラー
誰かが私に感謝しますか?
import java.util.Scanner ;
public class CoffeeBot {
public static void main(String[] args) {
int n1 = Integer.parseInt(args[0]);
int n2 = Integer.parseInt(args[1]);
for (int i = 0;i<args.length;i++) // REMEMBER TO PUT IN ARGS LENGTH
if (!(n1 > 0) && !(n2 > 0)) { // This is for both negative inputs n1 and n2
System.out.println("Negative supply chain. System terminating.");
return;
}
if (n1 < 0) { // This is for negative input n1
System.out.println("Negative supply of coffee cups. System terminating.");
return;
}
if (n2 < 0) { // This is for negative input n2
System.out.println("Negative supply of coffee shots. System terminating.");
return;
}
else {// If inputs comply with rules then proceed to here
System.out.println("Hello, what's your name?");
String name;
Scanner keyboard = new Scanner(System.in);
name = keyboard.next();
System.out.println("Would you like to order some coffee, " + name + "? (y/n)");
String yesno;
yesno = keyboard.next();
if (yesno.equalsIgnoreCase("y")) {
System.out.println("Great! Let's get started.");
System.out.println(" ");
System.out.println("Order selection");
System.out.println("---------------");
System.out.println(" ");
}
if (yesno.equalsIgnoreCase("n")) {
System.out.println("Come back next time, " + name +".");
return;
}
else {
System.out.println("Invalid response. Try again.");
while (yesno.toIgnoreCase("n"))
while (yesno.toIgnoreCase("y"))
}
}//else
} //main args
} //public class
'while(yesno.toIgnoreCase(" n "))'および 'while(yesno.toIgnoreCase(" y "))'は正しくフォーマットされていません – apicellaj
関連はありませんが、 –