Given an ArrayList, and we have to find an index of an element from an ArrayList using Java program.
ArrayList.indexOf()
This method returns index of an element exists in the ArrayList, if element is not find, it returns "-1".
In this program, there are 5 elements "100", "200", "300", "400" and "500" and we are getting the index of "300"
Consider the program
Output
need an explanation for this answer? contact us directly to get an explanation for this answer