Discussion :: Java.lang Class - Finding the output (Q.No.7)
Pratik Patel said: (Dec 19, 2011) | |
String x = "xyz"; x=x.toUpperCase(); String y = x.replace('Y', 'y'); y = y + "abc"; System.out.println(y); now o/p is XyZabc is it true?? |
Mayur said: (Dec 26, 2011) | |
Ya its correct now.xyx is converted to XYZ and is overwritten in x.nexY is replaced by y and then XyZ is concatenated with abc as + orks as concatenantion operator in Java with string types |
Atika said: (Jan 7, 2017) | |
Why not the answer is option D? |
Manoj said: (Jan 21, 2017) | |
As there is no reference created after x=x.toUpperCase(); statement. So the answer will be xyzabc. |
Namitha said: (Sep 28, 2018) | |
Sysout statement should display the value of y as xyz. I feel cos y= y+ abc would be lost. |
Post your comments here:
Name *:
Email : (optional)
» Your comments will be displayed only after manual approval.