0
我怎樣才能選擇1或2或3,並在運行程序後選擇選項菜單... 我不希望我的程序在選擇1或2後結束我該怎麼做.. 。 提前致謝。運行程序而不結束它
這是我選擇的選擇方案...
public class Dialog
{
AddList ad = new AddList();
int select;
void showDialog()
{
System.out.println("Enter The 1 for addnig data");
System.out.println("Enter The 2 for Waching the MARK data");
System.out.println("Enter The 3 for Waching the NAME data");
System.out.println("Enter The 4 for Waching All the data of students");
System.out.println("Enter The 5 for Waching SUM of the mark of Students");
}
void progressInput()
{
Scanner scan = new Scanner(System.in);
select = scan.nextInt();
if (select == 1)
{
ad.AddListIntoArray();
}
else if (select == 2)
{
ad.PrintMarkFromTheArray();
}
else if (select == 3)
{
ad.PrintNameFromTheArray();
}
else if (select == 4)
{
ad.PrintNameMarkFromTheArray();
}
else if (select == 5)
{
ad.SendMark();
}
else
{
System.out.println("Please Input range from 1 to 5 and not something else");
}
}
}
,這是我的主要程序....在這裏一切都很好,但我不希望我的節目結束選擇1或2後,我指的是節目1執行並顯示結果,並返回到選擇選項菜單...
public class Main
{
public static void main(String[] args)
{
Dialog dlg = new Dialog();
dlg.showDialog();
dlg.progressInput();
}
}
你想要一個循環。 – SLaks