0
Need solution
What is the output? String a="code"; System.out.println(a.substring(2)); How the output de?
2 ответов
+ 6
String::substring method() has two overloads, as covered in the following links
https://beginnersbook.com/2013/12/java-string-substring-method-example/
1st overload accepts an index and returns a copy of the string, starting from the character at the given index, till end of string.
2nd overload accepts a range of index, and returns a copy of the string starting from character at first given index and ends with the character at the second given index.
+ 4
The substring of "code" , from index 2 to till end is "de".