
1条回答 默认 最新
threenewbee 2020-05-24 09:18关注public static void main(String[] args) { string[] arr = {"", "Jan", "Feb", "Mar", "Apr", ... }; Random rand = new Random(); Scanner s = new Scanner(System.in); int mo = rand.nextInt(12) + 1; while (true) { System.out.println(mo + "月:"); String str1 = s.nextLine(); if (str1.equals(arr[mo])) { System.out.println("回答正确"); break; } else { System.out.println("回答错误,再来一次?yes 1 no 0"); String str2 = s.nextLine(); if (str2.equals("0")) break; } } }问题解决的话,请点下采纳
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报