0% found this document useful (0 votes)
5 views1 page

ArrayListQuestions

The document outlines a series of Java application tasks involving the use of ArrayList objects. Tasks include adding, removing, and replacing elements, as well as utilizing iterators and list iterators for displaying elements. Additionally, it involves creating a Student class and managing student data using ArrayLists with both setter and constructor injection methods.

Uploaded by

kacavep594
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

ArrayListQuestions

The document outlines a series of Java application tasks involving the use of ArrayList objects. Tasks include adding, removing, and replacing elements, as well as utilizing iterators and list iterators for displaying elements. Additionally, it involves creating a Student class and managing student data using ArrayLists with both setter and constructor injection methods.

Uploaded by

kacavep594
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ArrayList Questions

1. Create a Java Application where we need to create an ArrayList Object and


perform the following operations
a. Add five elements to the ArrayList Object
b. Print the ArrayList
c. Remove the element from the second index
d. Add a new element in the second index
e. Replace the third index with a new element.
f. Print the ArrayList by using Iterator.
2. Create a Java Application where we need to create an ArrayList Object by using
Integer as its Generic type. Add a few elements to it and print the list in forward
and backward directions by using ListIterator.
3. Create a Java Application where we need to create an ArrayList Object by using
Integer as its Generic type, add 100 elements to it, and print all the elements
alternatively by using Iterator.
4. Create a Java Application where we need to create two ArrayList Objects by
using Integer as its Generic type, add multiples of 2 to the first ArrayList and
multiples of 3 to the second ArrayList. Display the values of ArrayList2 which are
present in ArrayList1.
5. Create a Java Application where we need to create an ArrayList Object by using
Integer as its Generic type, add a few elements to it, and print all the elements
using the ForEach loop.
6. Create a Java Application where we need to create an ArrayList Object by using
Integer as its Generic type, Add a few elements to it, then print all the values in
ascending order.
7. Create a Java Application where we have one class Student, it contains private
fields like student ID, student Name, and student Marks without initialization.
Initialize these private fields by using both setter Injection and Constructor
injection. Add the data of 5 students and then create an ArrayList object by using
the Student class as its Generic type. Add the data of all students to this
ArrayList and then display all of them.
Note: Create the ArrayList Object in a separate user defined class.

You might also like