public void test2(){
Scanner input=new Scanner(System.in);
System.out.println("输入命令:1-按照图书名称查询;2-按照图书序号查询");
try{
int a=input.nextInt();
test1(a);
}catch(Exception e){
System.out.println("请正确输入:");
test2();
}
}
public void test1(int b){
Scanner input=new Scanner(System.in);
if(b==1){
System.out.println("输入图书的名称:");
String name=input.next();
if(name.equals("高数")||name.equals("英语")||name.equals("语文")){
System.out.println("book:"+name);
}else{
System.out.println("图书不存在!");
test2();
}
}
else{
System.out.println("输入图书的序号:");
int cc=input.nextInt();
String sm[]={"语文","数学","英语","政治","健康","财经","日语"};
if(cc<sm.length){
System.out.println("book:"+sm[cc]);
}else{
System.out.println("图书不存在!");
test2();
}
}
}
public static void main(String[] args) {
Initial hobby=new Initial();
hobby.test2();
}
點擊查看更多內(nèi)容
3人點贊
評論
評論
共同學(xué)習(xí),寫下你的評論
評論加載中...
作者其他優(yōu)質(zhì)文章
正在加載中
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦