Home » JAVA Programming » Generics » Question
  1. What is the output of this program?
    import java.util.*;
    class genericstack
    {
    Stack object = new Stack ();
    public void push(E obj)
    {
    object.push(obj);
    }

    public E pop()
    {
    E obj = object.pop();
    return obj;
    }
    }

    public class Output
    {
    public static void main(String args[])
    {
    genericstack genericObj = new genericstack();
    genericObj.push("Interview");
    System.out.println(genericObj.pop());
    }
    }
    1. Interview
    2. InterviewMania
    3. Interviw Mania
    4. Compilation Error
    5. Runtime Error
Correct Option: A

Interview



Your comments will be displayed only after manual approval.