Question: Write a single class PracticeArrayLists with main method in it. Do the following in the main method: 1) Declare an ArrayList named numberList that stores
Write a single class PracticeArrayLists with main method in it. Do the following in the main method:
1) Declare an ArrayList named numberList that stores objects of Integer type. Write a loop to assign first 10 elements values: 1, 8, 15, 22, 29, 36, 43, 50, 57, 64. Print numberList by using for-each loop.
2) Declare an ArrayList named booleanList that stores objects of Boolean data. Write a loop to assign first 50 elements alternating values false, true, false, true, . , and print all elements (10 per row) from booleanList by using for-each loop.
3) Declare an ArrayList named mountainList storing String objects. Write code to assign first five elements values Matterhorn, Triglav, K2, Aconcagua, and Kilimanjaro. Print the mountainList by using for-each loop.
Submit java file for class PracticeArrayLists, and picture of program run terminal window from BlueJ.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
