What will be the output of the following code snippet: System.out.println("2" + "3");?

  • "23"
  • "5"
  • 5
  • Error
In the given code snippet, the + operator is used to concatenate two string literals: "2" and "3." Therefore, the output will be the concatenation of these two strings, which is "23." It's important to note that when the + operator is used with strings, it performs string concatenation, not arithmetic addition.
Add your answer
Loading...

Leave a comment

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