Advertisements
Advertisements
Question
Differentiate between charAt() and substring().
Distinguish Between
Solution
S. No. | charAt() | substring() |
1. | Returns a character in the String at the nth place, counting from the 0th position. | This function extracts a set of characters from a specified index up to the end of a string. |
2. |
Example:
|
Example:
|
3. | In the above example, t is printed. | In the above example, BspAcp is printed. |
shaalaa.com
Is there an error in this question or solution?
Chapter 4: String Handling - EXERCISES [Page 289]