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!
B
B is wrong , C is correct !! compilation failure will occur..
the method replace() takes the argument as character type i.e in single quotes not in double quotes.
@ARJIT GAUTAM
Both, single quote and double quote will work!