Check out example codes for "add in list java". It will help you in understanding the concepts better.

Code Example 1

// Java code to show the implementation of 
// add method in list interface 
import java.util.*; 
public class GfG { 
  
    // Driver code 
    public static void main(String[] args) 
    { 
        List<Integer> l = new ArrayList<>(); 
        l.add(10); 
        l.add(15); 
        l.add(20); 
        System.out.println(l); 
    } 
}

Learn ReactJs, React Native from akashmittal.com