What will be the output of the following Java code snippet that calculates the…

PYQ IBPS SO CRP SPL-XIII (2023)

What will be the output of the following Java code snippet that calculates the length of a string without using the built-in length() method?

image.png

  1. A.

    The length of the string "Hello, World!" is: 13

  2. B.

    The length of the string "Hello, World!" is: 12

  3. C.

    Compilation Error

  4. D.

    Runtime Error: String cannot be null

  5. E.

    The length of the string "Hello, World!" is: 14

Attempted by 80 students.

Sign up free to check your answer

Sign up free

Explore the full course: Ibps So It Mains

Loading lesson…