Solved

What Is the Output of the Following Statements? ArrayList<String> Names

Question 84

Multiple Choice

What is the output of the following statements? ArrayList<String> names = new ArrayList<String>() ;
Names.add("Bob") ;
Names.add(0, "Ann") ;
Names.remove(1) ;
Names.add("Cal") ;
Names.set(2, "Tony") ;
For (String s : names)
{
System.out.print(s + ", ") ;
}


A) Cal, Bob, Ann
B) Ann, Bob
C) Ann, Cal, Tony
D) Array list bound error

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions