Q2. Write a java program to perform the following task: a) Create a collection ArrayList for Customer class b) Add 5 elements into ArrayList c) Display the element at index 4 d) Display all the elements in the ArrayList using for-each loop e) Remove the values at index 2 f) Add “cst2” in location 2. g) Check if st2 existing inside the collection.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 19RQ
icon
Related questions
Question

 

Q2. Write a java program to perform the following task:

  1. a) Create a collection ArrayList<String> for Customer class
  2. b) Add 5 elements into ArrayList
  3. c) Display the element at index 4
  4. d) Display all the elements in the ArrayList using for-each loop
  5. e) Remove the values at index 2
  6. f) Add “cst2” in location 2.
  7. g) Check if st2 existing inside the collection.

 

Expert Solution
steps

Step by step

Solved in 7 steps with 10 images

Blurred answer
Knowledge Booster
Program on Numbers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT