-
What is the output of this program?
import java.util.*;
public class Linkedlist_Example
{
public static void main(String args[])
{
LinkedList object = new LinkedList();
object.add("O");
object.add("V");
object.add("E");
object.addFirst("L");
System.out.println(object);
}
}
-
- [L]
- [L, O]
- [L, O, V]
- [L, O, V, E]
- None of these
Correct Option: D
object.addFirst(“L”) method is used to add ‘L’ to the start of a LinkedList object obj.