String Objects: Concatenation, Literals, and More

AP Computer Science A· difficulty 3/5

String a = "Cat";
String b = "cat";
System.out.println(a.equals(b));

What is printed?

  • A

    true

  • B

    false

    check_circle
  • C

    1

  • D

    0

Explanation

equals is case-sensitive; "Cat" and "cat" differ in case, so it returns false.

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

Related questions