Computer Science, asked by sonireena262, 8 months ago

ii) String s1= "good"; String s2= "world matters":
String str1=s2.substring(5).replace('t', 'n');
String 'str2=s1.concat(str1);
State the values of str1 and str2 and show dry run?

Answers

Answered by Oreki
2

After execution:

str1 = " manners"

str2 = "good manners"

Explanation:

As str1 = s2.substring(5) -> " matters" -> replace ('t', 'n') -> " manners".

And str2 = s1.concat(str1) -> "good" + " manners" -> "good manners".

Similar questions