What Will Be The Output Of The Following Java Codep Pre #731
What will be the output of the following Java code?</p> <pre><code class="language-java" line="1"> import java.util.*; class stack { public static void main(String args[]) { Stack obj = new Stack(); obj.push(new Integer(3)); obj.push(new Integer(2)); obj.pop(); obj.push(new Integer(5)); System.out.println(obj); } }</code></pre>
This multiple choice question (MCQ) is related to the book/course
gs gs128 Java.
It can also be found in
gs gs128 Java Util Collections Framework - Java.util - Vectors & Stack - Quiz No.1.
What will be the output of the following Java code?
import java.util.*; class stack { public static void main(String args[]) { Stack obj = new Stack(); obj.push(new Integer(3)); obj.push(new Integer(2)); obj.pop(); obj.push(new Integer(5)); System.out.println(obj); } }
[3, 5]
[3, 2]
[3, 2, 5]
[3, 5, 2]