Examveda

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);
    }
}

A. [3, 5]

B. [3, 2]

C. [3, 2, 5]

D. [3, 5, 2]

Answer: Option A


This Question Belongs to Java Program >> Collections Framework In Java

Join The Discussion

Related Questions on Collections Framework in java