Hello! I just started studying java. And I'm completely new in programming. I'm practicing to code with some problems given by some websites that i searched. Here's the problem.
PROBLEM: Count the number of "xx" in the given string. We'll say that overlapping is allowed, so "xxx" contains 2 "xx".
MY SOLUTION:
ERROR:
Compile problems:
Error: if((str.charAt(i)).equals('x')){
Cannot invoke equals(char) on the primitive type char
I can't understand the error. For me it must run just fine. Please Explain to me the meaning. Thanks!
Sorry if that's too easy for you. I'm really just inexperienced.
PROBLEM: Count the number of "xx" in the given string. We'll say that overlapping is allowed, so "xxx" contains 2 "xx".
MY SOLUTION:
ERROR:
Compile problems:
Error: if((str.charAt(i)).equals('x')){
Cannot invoke equals(char) on the primitive type char
I can't understand the error. For me it must run just fine. Please Explain to me the meaning. Thanks!
Sorry if that's too easy for you. I'm really just inexperienced.