Solved

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

Question 36

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(1, "Tony") ;
For (String s : names)
{
System.out.print(s + ", ") ;
}


A) Cal, Bob, Ann
B) Ann, Bob
C) Ann, Tony
D) Cal, Bob, Tony

Correct Answer:

verifed

Verified

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

Related Questions