Java program to store different types of items in the linked list
// Java program to store different types of items
// in the linked list
import java.util.LinkedList;
public class Main {
public static void main(String[] args) {
LinkedList list = new LinkedList();
list.add(1);
list.add("TWO");
list.add(3);
list.add("FOUR");
list.add(true);
System.out.println("List Items: \n" + list);
}
}
Output
List Items:
[1, TWO, 3, FOUR, true]