What Will Be The Output Of The Following Java Codep Pre #697
What will be the output of the following Java code?</p> <pre><code class="language-java"> import java.util.*; public class LinkedList { public static void main(String args[]) { LinkedList l = new LinkedList(); l.add(1); l.add(2); l.add(4); l.add(5); l.add(3); l.remove(3); System.out.println(l); } }</code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs111 OOP Object Oriented Programming Java. It can also be found in gs gs111 Types of Classes (Using Java) - Collection Classes - Quiz No.1.
What will be the output of the following Java code?
import java.util.*; public class LinkedList { public static void main(String args[]) { LinkedList l = new LinkedList(); l.add(1); l.add(2); l.add(4); l.add(5); l.add(3); l.remove(3); System.out.println(l); } }
[1, 2, 5, 3]
[1, 2, 4, 3]
[1, 2, 4, 5]
Compilation Error