有必要弄得這么麻煩嗎? 最直接的就是用oracle的job ,全部都在數(shù)據(jù)庫(kù)內(nèi)部執(zhí)行,不用擔(dān)心鏈接會(huì)斷掉。
鄂城ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書(shū)未來(lái)市場(chǎng)廣闊!成為成都創(chuàng)新互聯(lián)公司的ssl證書(shū)銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書(shū)合作)期待與您的合作!
在外部實(shí)現(xiàn)的話也用高級(jí)點(diǎn)的存儲(chǔ)過(guò)程,速度快,穩(wěn)定性好。 有些業(yè)務(wù)不要完全去依賴外部程序。想你這樣的情況完全可以用job實(shí)現(xiàn)
使用方法調(diào)用,配合循環(huán)
寫一段偽代碼,可能會(huì)幫你理清思路:
do{
游戲開(kāi)始運(yùn)行;
...
..
//循環(huán)中可以用方法調(diào)用來(lái)運(yùn)行游戲
//游戲失敗,給用戶提示
再玩一次?
接受用戶的選擇
//如果用戶選擇"是",再次循環(huán),游戲重新開(kāi)始
//如果用戶選擇”否",退出循環(huán),游戲結(jié)束
}while(真);
你的程序有一些小錯(cuò)誤,我給你改了,并且按照你的要求在輸入錯(cuò)誤的情況下,程序能夠重新運(yùn)行,你看一下吧。輸入-1程序停止。
import java.util.*;
class Test
{
public static void main(String[]args)
{
int month=0,seat=0;
try{
Scanner s=new Scanner(System.in);
System.out.println("輸入月份:");
month =s.nextInt();
System.out.println("輸入艙位,頭等艙為1,經(jīng)濟(jì)艙為2:");
seat=s.nextInt();
}catch(Exception e){
System.out.println("請(qǐng)輸入整數(shù)!");
}
while(seat!=-1 month!=-1){
if(month=4month=10)
{
if(seat==1)
System.out.println("您的機(jī)票價(jià)為4500RMB");
else if(seat==2)
System.out.println("您的機(jī)票價(jià)為4000RMB");
else
System.out.println("您輸入的艙位代號(hào)有誤");
}
else if(month0month4 || month10month=12)
{
if(seat==1)
System.out.println("您的機(jī)票價(jià)為2500RMB");
else if(seat==2)
System.out.println("您的機(jī)票價(jià)為2000RMB");
else
System.out.println("您輸入的艙位代號(hào)有誤");
}else{
System.out.println("您輸入的月份有誤");
}
try{
Scanner s=new Scanner(System.in);
System.out.println("輸入月份:");
month =s.nextInt();
System.out.println("輸入艙位,頭等艙為1,經(jīng)濟(jì)艙為2:");
seat=s.nextInt();
}catch(Exception e){
System.out.println("請(qǐng)輸入整數(shù)!");
}
}
}
}
String flag = "n";Scanner input = new Scanner(System.in);do{System.out.println("請(qǐng)輸入數(shù)字1:");int a = input.nextInt();System.out.println("請(qǐng)輸入數(shù)字2:");int b = input.nextInt();System.out.println(a+"+"+b+"="+(a+b));System.out.println("是否繼續(xù)?(y/n)");flag = input.next();}while(flag.equals("y"));將此放入main函數(shù)中可以實(shí)現(xiàn)你想要的效果
本文題目:java用代碼讓程序重新 java怎么重新運(yùn)行
網(wǎng)站網(wǎng)址:http://jinyejixie.com/article16/ddcohdg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供軟件開(kāi)發(fā)、App設(shè)計(jì)、網(wǎng)頁(yè)設(shè)計(jì)公司、靜態(tài)網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)、做網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)