You can use b.length
to find out how many characters there are.
This is only the number of characters, not indexing, so if you iterate over it with a for
loop, remember to write it like this:
for(int i=0;i < b.length; i++)
Note the <
(not a <=
). It’s also important to note that since the array isn’t a class, .length
isn’t a function, so you shouldn’t have parenthesis afterward.