1
 }else if(readUserEmail.contains('a')){
        System.out.print("true");

Why am I getting a java.lang.Charsequence cannot be applied to a char error? In this case readUserEmail is a string of an email.

Termininja
  • 6,620
  • 12
  • 48
  • 49
eli
  • 335
  • 1
  • 3
  • 18

1 Answers1

1

The contains method of the String class takes a CharSequence as an argument, but you are providing a character literal as indicated by using single quotes.

Change your 'a' to "a". Double quotes are for String (which implements the CharSequence interface) and single quotes are for characters.

Matt
  • 3,677
  • 1
  • 14
  • 24