How are you doing?

Given:
1. class Test2 {
2. static String setMessage(String str) {
3. return str + “How are you doing?”;
4. }
5.
6. public static void main(String[] args) {
7. String str = “Hello! “;
8. str = setMessage(str);

9. System.out.println(“str : ” + str);
10. }
11. }
What is the result?

Given:
1. class Test2 {
2. static String setMessage(String str) {
3. return str + “How are you doing?”;
4. }
5.
6. public static void main(String[] args) {
7. String str = “Hello! “;
8. str = setMessage(str);

9. System.out.println(“str : ” + str);
10. }
11. }
What is the result?

A.
Compilation fails because of an error at line 7.

B.
str : Hello!

C.
str : How are you doing?

D.
Compilation fails because of an error at line 2.

E.
Compilation fails because of an error at line 3.

F.
str : Hello! How are you doing?

G.
Compilation fails because of an error at line 8.



Leave a Reply 0

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