Please enable JavaScript to use CodeHS

CodeHS Glossary


Substring Java

A substring is a smaller sequence of characters in a larger String. You can use the `substring` method to get a substring of a String in Java. ``` String str = "good day"; String sub1 = str.substring(0, 4); // sub1 will hold "good" ```