Task 6b - ArrayList

Make a class User with only id and name. Define a constructor that take at least id.

Make an ArrayList of User, and perform following operations:

  1. Add few User objects into it
  2. Replace object at index i with a new object 
  3. Add new object at specific index
  4. Print size of list after each operation
  5. Remove an object from list by index
  6. Remove an object by passing object reference
  7. Convert the list into an Array and print the Array elements
  8. Define a method that receives the list and print its all elements (id and name attribute)
  9. Call above method after each operation listed above
  10. Create a sublist from index 3 to 5 (I assume there are at least 6 objects in your list)
  11. Make a new list with 3 objects, and add the new list elements into already defined list


Popular posts from this blog

Task 12 - Create Java Program with MySQL Database Connectivity

Java Interfaces and Exception Handling - Practice Problem with Solution

Task 16 - Javafx Program to Create, Retrieve, Update and Delete records with Database