import java.util.*; public class QuizEx1 { public static void main(String[] args){ String[] data = { "れ 譴 れ螳 蟆?`2`final`True`if`public", "れ 譴 覦 一一螳 蟆?`5`&`|`++`!=`/`^", "れ 譴 覃 覦螳 覩誤 れ?`1`void`null`false", }; int[] answer = {2, 6, 1}; int score = 0; Scanner s = new Scanner(System.in); shuffle(data); for(int i=0;i<data.length;i++){ String[] strArr = data[i].split("`"); for(int j=0;j<strArr.length;j++){ switch(j){ case 0 : System.out.println("[" + (i+1) + "]" + strArr[j]); break; case 1 : break; default : System.out.print(j-1 + "." + strArr[j] + " "); } } System.out.print("\r\n[]"); if (answer[i] == Integer.parseInt(s.nextLine())){ score++; } System.out.println(""); } //for System.out.println("糾/豌企誤 : " + score + "/" + data.length); } //main public static void shuffle(String[] data){ if (data.length > 0){ int rand; String tmp; for(int i=0; i<data.length;i++){ rand = (int)(Math.random() * 10 % data.length); tmp = data[i]; data[i] = data[rand]; data[rand] = tmp; } } } //shuffle }