Reputation: 335
}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.
Upvotes: 1
Views: 1981
Reputation: 3760
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.
Upvotes: 1