Multiple Choice
Consider the following code snippet: public static void main(String[] args)
{
ArrayList<String> names = new ArrayList<String>() ;
Names.add("John") ;
Names.add("Jerry") ;
Names.add("Janet") ;
ArrayList<String> names2 = reverse(names) ;
}
Public static ArrayList<String> reverse(ArrayList<String> names)
{
ArrayList<String> result = new ArrayList<String>() ;
For (int i = names.size() - 1; i >= 0; i--)
{
Result.add(names.get(i) ) ;
}
Return <String>result;
}
Which statement is true after the main method is executed?
A) names contains "Janet", "Jerry", "John" in this order
B) names contains "John", "Jerry", "Janet" in this order
C) reverse method has a bound error
D) Compilation error due to the return statement in reverse method
Correct Answer:

Verified
Correct Answer:
Verified
Q91: Which statement is true about the code
Q92: Which one of the following code snippets
Q93: Which code snippet prints out the elements
Q94: What will be printed by the statements
Q95: Assume the method doSomething has been defined
Q97: Consider the following line of code for
Q98: Assume the following variable has been declared
Q99: Select the statement that reveals the logic
Q100: Which statement is true about the code
Q101: Which one of the following statements is