Question: In main method create a words arrayList and add the following string values into it. Values: soccer, baseball, football, hockey, basketball At the end, call
In main method create a words arrayList and add the following string values into it.
Values: soccer, baseball, football, hockey, basketball
At the end, call test method inside the main method then
print words arraylist in console
test() method will take an argument of String ArrayLists called words, and then set the 0th and 2nd indexes to be "git" and "gud" respectively.
------------------
import java.util.*;
class Main {
//your main method code here by creating the ArrayList named "words" public static void main(String[] args) { //Create Your words ArrayList Here
System.out.println(words); test(words); System.out.println(words); }
public static void test(ArrayList
} }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
