Multiple Choice Question

Quiz Guidelines

 

QID: 
114
Question: 

What will be the contents of s1 and s2 at the time of the println statement in the main method of the following program?

import java.util.*;
public class TestClass{
public static void main(String args[]){
Stack s1 = new Stack ();
Stack s2 = new Stack ();
processStacks (s1,s2);
System.out.println (s1 + " "+ s2);
}
public static void processStacks(Stack x1, Stack x2){
x1.push (new Integer ("100")); //assume that the method push adds the x2 = x1;
}
}

Select 1 option

A. [100] [100]
B. [100] []
C. [] [100]
D. [] []

Q&A Set: