+ 1
What's a mistake in this code?
1 Answer
- 1
b is shorter than s
you try to get an index of s and apply it at b, but b is too short,
so used index is out of possible range
example
b has index: 01 but not 2
b: " K"
if b is " K" chars long and you try char at index 2
it is not possible
for (int j=0; j<s.length(); j++) {// all s chars index
char dh = b.charAt(j); // get char at b by index of s