Returns a substring from the specified begin index to end index.
Syntax
str.substring(begin, end?)Example
Enter values below to update the example in real time.
String→System→out→println→String s = "Hello, World!";
System.out.println(s.substring(7)); // "World!"
System.out.println(s.substring(7, 12)); // "World"