What is O/p......? public class Main{ public static void main (String[]args){ String str = 'A '; str = str.concat('B '); System.out.println(str); String tb = 'C '; str = str.concat(tb); System.out.println(str); str.replace('C', 'D'); System.out.println(str); str = str.concat(tb); System.out.println(str); } } Output: A B A B C A B C A B C C public class Main{ public static void main (String[]args){ String str = 'A '; str = str.concat('B '); System.out.println(str); String tb = 'C '; str = str.concat(tb); System.out.println(str); str=str.replace('C', 'D'); System.out.println(str); str = str.concat(tb); System.out.println(str); } } Output: A B A B C A B D A B D C Explanation: replace method return value is not assigned in the first program so the value of str is not changed. - Study24x7
Social learning Network
86 followers study24x7 22 Nov 2019 06:57 PM study24x7 study24x7

What is O/p......? public class Main{ public static void main (String[]args){ String str = "A "; str = str.concat("B "); System.out.println(str); String tb = "C "; str = str.concat(tb); System.out.println(str); str.repla...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles