Menu
Topics Index
...
`

String1370


If you need explanation Read this topic

If you need Answer Take test on this topic

String1370
What will be the output of the following program?
public class Lovely {
    public static void main(String... args) {
        String a = "TATTARRATTAT";
        String b = a.toLowerCase();
        b.replace('a', 'o');
        b.replace('t', 'o');
        b.replace('r', 'o');
        System.out.println(b);
        System.out.println(b.replace('o', 'a'));
    }
}

A. tattarrattat
tattarrattat
B. oooooooooooo
aaaaaaaaaaaa
C. tattarrattat
tottorrottot
D. Compilation Error
E. Runtime Error
Topic: toLowerCase() And toUpperCase() Methods In Java

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

answer is a :string is an immutable object...
changes are effected in the string only if we assign it again...

Posted by Santosh Munugota    2013-06-05 12:33:36


Ans:c string are immutable

Posted by Indrasena Reddy    2013-06-05 12:34:37


Congratulations Santosh Munugota. You are today's daily dose winner. Please send us your mobile details and we will process it tomorrow after considering the new likes.

Posted by Merit Campus    2013-06-05 15:21:07


got RC! :) :)

Posted by Santosh Munugota    2013-06-06 14:59:50


© meritcampus 2019

All Rights Reserved.

Open In App