What is the result?

Given:
1. class Test {
2. public static void main(String[] args) {
3. String str = “Hello”;
4. str = str.replace(“Bye”);
5. System.out.println(“str : ” + str);
6. }
7. }
What is the result?

Given:
1. class Test {
2. public static void main(String[] args) {
3. String str = “Hello”;
4. str = str.replace(“Bye”);
5. System.out.println(“str : ” + str);
6. }
7. }
What is the result?

A.
Compilation fails.

B.
str : HelloBye

C.
str : Byelo

D.
str : Hello

E.
str : Bye

F.
str : HeBye

G.
The code runs with no output.



Leave a Reply 0

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