What will be the output of the program? String x = "xyz"; x.Touppercase(); string y = x.Replace('y', 'y'); y = y + "abc"; system.Out.Println(y);?
Answers
Answer:
xyzabc
Explanation:
x=xyz
now x.toUpperCase() but value is stored nowhere so it's of no use
y=x.replace('y','y')
again y is replaced with y it's of no use
just y is now xyz
y=y+abc
y becomes
xyzabc
Answer: XyZabc
Concept : Computer Programming
Given : String x = "xyz"; x.Touppercase(); string y = x.Replace('y', 'y'); y = y
+ "abc"; system.Out.Println(y);
To Find : What will be the output of the program?
Explanation:
The given program is :
// x = "xyz" is the pre - defined input already given
String x = "xyz";
// toUpperCase() is the pre - defined function to convert lowercase //characters to uppercase characters
x.Touppercase();
// Replace() is also a predefined function , to replace the chosed //character by the given character
string y = x.Replace('y', 'y');
// Now, y = XyZ
// String concatination is done
y = y + "abc";
// System.out.println() is also a predefined function in Java used to print //the given sentences in parenthesis on the screen.
system.Out.Println(y);
Output of the above program : XyZabc
#SPJ3