What Will Be The Output Of The Following Java Codep Pre #590
What will be the output of the following Java code?</p> <pre><code class="language-java"> import java.util.*; public class lists { public static void main(String args[]) { LinkedList l = new LinkedList(); l.add(28); l.add(41); l.add(4); l.add(3); l.add(10); l.remove(4); 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 Class Components (Using Java) - Memory Allocation - Quiz No.1.
What will be the output of the following Java code?
import java.util.*; public class lists { public static void main(String args[]) { LinkedList l = new LinkedList(); l.add(28); l.add(41); l.add(4); l.add(3); l.add(10); l.remove(4); System.out.println(l); } }
[28, 41, 4, 3]
[28, 41, 3, 10]
[28, 41, 4, 10]
Compilation Error