Multiple choice

How many string objects are created by the given statement? String str=new String(“Aliens”);

  1. 0

  2. 1

  3. 2

  4. 4

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The given statement creates 2 objects. The first object is refereed to by “str” and the second by the last string “Aliens”.