previous |
start |
next
Debugging the Word Constructor
- Supply "hello" input again
- Break past the end of second loop in constructor
- Inspect i and j
- They are 0 and 4--makes sense since the input consists of
letters
- Why is text set to "hell"?
- Off-by-one error: Second parameter of substring is the
first position not to include
- text = substring(i, j);
should be
text = substring(i, j + 1);
previous |
start |
next