String Methods

AP Computer Science A· difficulty 2/5

String s = "Hello";
System.out.println(s.length());

What is printed?

  • A

    5

    check_circle
  • B

    Hello

  • C

    6

  • D

    4

Explanation

The string "Hello" contains 5 characters, so length() returns 5.

Want 10 more like this — adaptive to your weak spots?

Related questions