What is the result?

<code>
public class StringReplace {
public static void main(String[] args) {
String message = “Hi everyone!”;
System.out.println(“message = ” + message.replace(“e”, “X”)); }
}
</code>
What is the result?


public class StringReplace {
public static void main(String[] args) {
String message = "Hi everyone!";
System.out.println("message = " + message.replace("e", "X")); }
}

What is the result?

A.
message = Hi everyone!

B.
message = Hi XvXryonX!

C.
A compile time error is produced.

D.
A runtime error is produced.

E.
message =

F.
message = Hi Xveryone!



Leave a Reply 2

Your email address will not be published. Required fields are marked *


sully

sully

think A is correct answer
strings are immutable so value can’t be altered.
It would work if using a sring builder.

noname

noname

B is correct.
You can try to compile it.