0

I have some problems with my code

public static void main(String args[]) {
          String Str = new String("adminn, super, supervisor");

          if(Str.matches(".*(admin).*")) {
              System.out.println("here we go");
          }else {
              System.out.println("out");
          }
      
   }

This is my code, The expected result the output is "out" what should be "here we go again" Is there a way to make the values of String str exactly match?

I hope you suggest maybe using regex or anything,

0 Answers0