樱花视频在线观看-西西人体大胆4444ww张筱雨-久久网免费视频-国产99页-91高清视频在线-日日干夜夜干-91社区视频-中文高清av-久久成人国产-亚洲日韩欧洲乱码av夜夜摸-97人人射-亚洲视频观看-理论片亚洲-亚洲精品99999-免费能看的黄色片-精人妻无码一区二区三区-奇米影视播放器

游戲產(chǎn)業(yè)研究網(wǎng)

Java題,作業(yè)求解

使用if...else..判斷:

import java.util.Scanner;

public class test {

public static void main(String[] args) {

int mouth;

while(1==1){

System.out.println(請輸入月份:);

mouth=new Scanner(System.in).nextInt();

if (mouth==0) {

System.out.println(一月);

}else if (mouth==1) {

System.out.println(二月);

}else if (mouth==2) {

System.out.println(三月);

}else if (mouth==3) {

System.out.println(四月);

}else if (mouth==4) {

System.out.println(五月);

}else if (mouth==5) {

System.out.println(六月);

}else if (mouth==6) {

System.out.println(七月);

}else if (mouth==7) {

System.out.println(八月);

}else if (mouth==8) {

System.out.println(九月);

}else if (mouth==9) {

System.out.println(十月);

}else if (mouth==10) {

System.out.println(十一月);

}else if (mouth==11) {

System.out.println(十二月);

}else {

System.out.println(請重新輸入月份 );

break;

}

}

}

}

使用switch:

import java.util.Scanner;

public class test{

public static void main(String[] args) {

int mouth;

do{

System.out.println(請輸入月份:);

mouth=new Scanner(System.in).nextInt();

switch(mouth){

case 0:

System.out.println(一月);

break;

case 1:

System.out.println(二月);

break;

case 2:

System.out.println(三月);

break;

case 3:

System.out.println(四月);

break;

case 4:

System.out.println(五月);

break;

case 5:

System.out.println(六月);

break;

case 6:

System.out.println(七月);

break;

case 7:

System.out.println(八月);

break;

case 8:

System.out.println(九月);

break;

case 9:

System.out.println(十月);

break;

case 10:

System.out.println(十一月);

break;

case 11:

System.out.println(十二月);

break;

default:

System.out.println(請重新輸入月份);

break;

}

}while (mouth>=0&&mouth<=11);

}

}

明星| 丹阳市| 衡山县| 吐鲁番市| 巩留县| 博乐市| 阳西县| 杨浦区| 驻马店市| 杨浦区| 兰西县| 舞阳县| 三穗县| 黄平县| 清水河县| 保山市| 阿勒泰市| 白城市| 盘锦市| 台前县| 永嘉县| 广德县| 余江县| 安化县| 建阳市| 错那县| 黎川县| 松桃| 谢通门县| 绩溪县| 绵竹市| 铁岭市| 叙永县| 商南县| 南京市| 驻马店市| 洛扎县| 新昌县| 云南省| 乌拉特中旗| 宝应县|