+ 2

What is substring in java and how to use it?

20th May 2020, 1:33 PM
DOT X
DOT X - avatar
2 ответов
+ 18
The substring begins with the character at the specified index and extends to the end of this string... . . This will definitely help you.👇 https://www.geeksforgeeks.org/substring-in-java/amp/
20th May 2020, 1:45 PM
Shruti
Shruti - avatar
+ 1
Substring as the name says is a part of a string. In Java, the substring method can either take a single parameter and print the string content from that index to the end of the string. Or you can pass two parameters, where the first one in the starting index and the second one is the last index which is not included. String name = "Shashank"; System.out.println(name.substring(2)); // This will print -> ashank System.out.println(name.substring(2,6)); // This will print -> asha
20th May 2020, 2:28 PM
Avinesh
Avinesh - avatar