Question: Consider the following code snippet: public static void main ( String [ ] args ) { ArrayList names = new ArrayList ( ) ; names.add
Consider the following code snippet:
public static void mainString args
ArrayList names new ArrayList;
names.addJohn;
names.addJerry;
names.addJanet;
ArrayList names reversenames;
public static ArrayList reverseArrayList names
ArrayList result new ArrayList;
for int i names.size; i ; i
result.addnamesgeti;
return result;
Which statement is true after the main method is executed?
Question options:
names contains "Janet", "Jerry", "John" in this order.
names contains "John", "Jerry", "Janet" in this order.
reverse method has a bound error.
Compilation error due to the return statement in reverse method.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
