Explore what CodeHS has to offer for districts, schools, and teachers.
Click on one of our programs below to get started coding in the sandbox!
View All
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" ```