#title Word Scramble {{{ import java.util.*; public class WordScrambleEx1 { public static void main(String[] args){ String[] strArr = {"Change", "Love", "Hope", "View"}; String answer = getAnswer(strArr); String question = getScrambledWord(answer); Scanner scan = new Scanner(System.in); char[] hint = new char[answer.length()]; for(int i=0;i < hint.length;i++) { hint[i] = '_'; } System.out.println("질문: "+question); for(;;){ System.out.print("답변: "); String strIn; strIn = scan.nextLine(); if (strIn.equalsIgnoreCase("q")) System.exit(0); if (strIn.equalsIgnoreCase(answer)){ System.out.println("축하합니다. 정답입니다!!"); System.out.println(); break; } else{ System.out.println("정답이 아닙니다. 다시 입력하세요:"); System.out.println("Hint:" + getHint(answer, hint)); } } //for } // main public static String getAnswer(String[] strArr){ int rand = (int)(Math.random() * 10 % strArr.length); return strArr[rand]; } //getAnswer public static String getScrambledWord(String str){ char[] chArr = str.toCharArray(); char tmp; int rand; for(int i=0;i2){ for(int i=0;i