in the book i’m learning from i came across this code snippit:
while (i < len) {
char c = s.charAt(i);
if (c == ’(’) {
count = count + 1;
} else if (c == ’)’) {
count = count - 1;
}
i = i + 1;
}
what do the apostrophes mean in (c == '(') ? also isn’t there a syntax error here? it looks like (c == '(') needs another ) at the end of it.
what about here : else if (c == ’)’) ?
They surround a
charin the same way that"surround a string likeString s = "a string".In the code, it is testing if
cis a(character.(BTW, you have
’characters in your code, and I think these should be'characters.)