📜  如何将字符串与用户输入的字符串匹配 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:17.484000             🧑  作者: Mango

代码示例1
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