how to match numbers from string and user input in java code example

Example: how to match the string with the user input string

while (x == 1) 
  {
       String[] riddles = new String[5] ;  
          riddles[0] = ("Hellowrite1") ;
          riddles[1] = ("write2") ;
          riddles[2] = ("write3") ;
          riddles[3] = ("write4") ;
          riddles[4] = ("write5") ; 

       String[] answers = new String [5] ;
          answers[0] = ("1") ;
          answers[1] = ("2") ;
          answers[2] = ("3") ;
          answers[3] = ("4") ;
          answers[4] = ("5") ; 
int riddlenumber;
   riddlenumber = rand.nextInt (5);
   System.out.println (riddles [riddlenumber]);
   String useranswer;
   useranswer = scan.next();
   if

Tags:

Misc Example