arraylist lastindexof 28object o 29 method in java

Solutions on MaxInterview for arraylist lastindexof 28object o 29 method in java by the best coders in the world

showing results for - "arraylist lastindexof 28object o 29 method in java"
Luisa
04 Jan 2019
1import java.util.ArrayList;
2public class ArrayListLastIndexOfMethodExample
3{
4   public static void main(String[] args)
5   {
6      ArrayList<Integer> al = new ArrayList<Integer>();
7      al.add(40);
8      al.add(98);
9      al.add(20);
10      al.add(98);
11      al.add(35);
12      al.add(45);
13      al.add(35);
14      System.out.println("Last occurrence of element 98 is: " + al.lastIndexOf(98));
15      System.out.println("Last occurrence of element 35 is: " + al.lastIndexOf(35));
16   }
17}