📊 JAVA
Q. What is the output of the following code?
Code:
String str1 = “hello”;
String str2 = “world”;
System.out.println(str1 + str2);
  • (A) “helloworld”
  • (B) “hello world”
  • (C) “hello” “world”
  • (D) There is a syntax error in the code.
💬 Discuss
✅ Correct Answer: (A) “helloworld”

Explanation: The two String variables str1 and str2 are concatenated using the + operator, which results in the combined string “helloworld”.

Explanation by: Deepak Sahoo
The two String variables str1 and str2 are concatenated using the + operator, which results in the combined string “helloworld”.

💬 Discussion


📊 Question Analytics

👁️
212
Total Visits
📽️
3 y ago
Published
🎖️
Deepak Sahoo
Publisher
📈
89%
Success Rate