Skip to content

Instantly share code, notes, and snippets.

@gauravkukade
Created October 15, 2019 07:04
Show Gist options
  • Save gauravkukade/904f63dba09cecc4fa9bb39f2b6a359a to your computer and use it in GitHub Desktop.
Save gauravkukade/904f63dba09cecc4fa9bb39f2b6a359a to your computer and use it in GitHub Desktop.
A Java program to explain the substring method, which accepts both parameter 'beginIndex' and 'endIndex'. This example is used in a blog a https://coderolls.com/java-substring-method
/**
* A Java program to explain the substring method,
* which accepts both parameter 'beginIndex' and 'endIndex'.
*
*
* @author Gaurav Kukade at coderolls.com
*
*/
public class SubstringExampleWithBothIndex {
public static void main(String[] args) {
String name = "codeRolls.com";
String result = name.substring(4, 9);
System.out.println(result);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment