String Methods

AP Computer Science A· difficulty 3/5

String s = "computer";
System.out.println(s.substring(3));

What is printed?

  • A

    puter

    check_circle
  • B

    mputer

  • C

    comp

  • D

    compu

Explanation

substring(3) returns the substring beginning at index 3 to the end, which is "puter".

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

Related questions