1(xix)
Assertion (A): The substring() method modifies the original String.
Reason (R): The substring() method can extract part of a String starting from a specific index.
- (a)(A) is true and (R) is false.
- (b)(A) is false and (R) is true.
- (c)Both (A) and (R) are true and (R) is a correct explanation of (A).
- (d)Both (A) and (R) are true and (R) is not a correct explanation of (A).
Show SolutionHide Solution↓
(A) is false and (R) is true.
Reason — In Java, Strings are immutable, so the substring() method does not modify the original String, it returns a new String, making Assertion (A) false. However, the method does extract a part of the String starting from a specific index, which makes Reason (R) true.