R

Ram Sharma • 3.40K Points
Extraordinary

Q. What is the output of this code?

Code:
String s = "Java";
System.out.println(s.length());
  • (A) 3
  • (B) 4
  • (C) 5
  • (D) 0
  • Correct Answer - Option(B)
  • Views: 21
  • Filed under category Java
  • Hashtags:

Explanation by: Ram Sharma

`s.length()` returns the number of characters in the string "Java", which is 4.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.