Question: outputs Question 2 . Select 4 methods from the following table. Write a full explanation for these selected method in the Arraylist. Show by writing

outputs
Question 2 . Select 4 methods from the following table. Write a full explanation for these selected method in the Arraylist. Show by writing a full code the functionality of these methods. Define your array using any datatype. Method Description add clear contains get indexOf Adds an element to the end of the ArrayList. Removes all the elements from the ArrayList. Returns true if the ArrayList contains the specified element; otherwise, returns false. Returns the element at the specified index. Returns the index of the first occurrence of the specified element in the ArrayList. Overloaded. Removes the first occurrence of the specified value or the ele- ment at the specified index. Returns the number of elements stored in the ArrayList. Trims the capacity of the ArrayList to the current number of elements. remove size trimToSize Fig. 6.16 Some methods and properties of class ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
