If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Fix-it Problems

Problem

Java can't compile this code due to an error. What line of code has the error?
1for (int i = 0; i < str.length; i++) {
2  String letter = str.substring(i, i+1);
3  System.out.println(letter.toUpperCase());
4}
Choose 1 answer: