Type argument cannot be primitive type in JAVA

Type argument cannot be primitive type

In java primitive types cannot be used in generics types so we use Wrapper classes and we can combine them with autoboxing to send primitive type as Wrapper classes. To know more about Wrapper Classes and Autoboxing, visit the following links: Wrapper classes, Autoboxing and Unboxing

import java.util.List;
import java.util.ArrayList;

public class ThreadSleep {

    public static void main(String args[]) {
    	// This is not working
        List list = new ArrayList<>();

        // Use this instead
        List list = new ArrayList<>();

        int i = 2;
        list.add(i);
    }

}