Java, how to compare Strings with String Arrays

后端 未结 6 1953
耶瑟儿~
耶瑟儿~ 2020-12-15 06:07

I have been searching here for some time but haven\'t been able to find the answer to it.

I am basically required to use an array for this assignment from college. A

6条回答
  •  甜味超标
    2020-12-15 07:03

    I presume you are wanting to check if the array contains a certain value, yes? If so, use the contains method.

    if(Arrays.asList(codes).contains(userCode))
    

提交回复
热议问题