再次我需要幫助關於Java編程.. 我試圖使通過是/否是聽命的方法..但似乎我得到一個錯誤:「非法啓動表達」和‘錯誤‘’預計’遷移到另一種方法
如果用戶輸入是/是的,它會移動到方法MainProgram(主程序) 如果用戶輸入不,它會再見打印,並將退出 ,如果用戶輸入一邊從是/否會再次詢問,直到滿足條件
請幫助我真的需要這個..是的是學校的相關。這其實是程序的一半,告訴我是否需要整個程序。謝謝!
import java.io.*;
public class Testing{
public static void main (String args[])throws IOException{
String p;
final String proc="Yes";
final String decl="No";
System.out.print("Do you want to proceed? - Yes/No");
p=inpt.readLine();
for(int i=1; i<=1; i++){
if (p.equalsIgnoreCase(proc)){
MainProgram();
} else if (p.equalsIgnoreCase(decl)){
System.out.println("Goodbye!");
System.exit(0);
} else
System.out.println("Wrong Input");
System.out.println();
i=i-1;
continue;
}
public void MainProgram(){
System.out.println("How many sets of students' grades would you like to record?");
System.out.print("Answer: ");
rec = Integer.parseInt(inpt.readLine());
System.out.println();
當你問一個關於Java編程你一定要添加【JAVA]標籤問題該鏈接將幫助你在未來,如果現在不http://thenewboston.org/list.php?cat=31 – DogCoffee
。 – Pavlo
噢,我很抱歉.. – user2768501