Strings and characters

Edit on Github instead

Strings are made up of characters, or what Java calls chars. A string's characters are numbered from left to right, starting with 0.

String s = "My phone";

In the string "My phone", the M is at index 0, the y at index 1, the at index 2, the p at index 3, etc:

Character M y p h o n e
Index 0 1 2 3 4 5 6 7

Suggest changes

Related links

URL Topic Source