List all the internal contents of a class in Java.
Answers
Explanation:
List Interface in Java with Examples
The List interface provides a way to store the ordered collection. It is a child interface of Collection. It is an ordered collection of objects in which duplicate values can be stored. Since List preserves the insertion order, it allows positional access and insertion of elements.

Declaration: The List interface is declared as:
public abstract interface List extends Collection
Example of a List:
// Java program to demonstrate a List
import java.util.*;
public class ListDemo {
public static void main(String[] args)
{
// Creating a list
List<Integer> l1
= new ArrayList<Integer>();
// Adds 1 at 0 index
l1.add(0, 1);
// Adds 2 at 1 index
l1.add(1, 2);
System.out.println(l1);
// Creating another list
List<Integer> l2
= new ArrayList<Integer>();
l2.add(1);
l2.add(