当前位置:在线题库搜索>[多选题]public class StackTest { public static void main(String[] args) { Stack<Integer> st = new Stack<Integer>(); st.push(new Integer(11)); st.push(new Integer(22)); st.push(new Integer(33));   System.out.println("size is-> "+st.size()); System.out.println("Top is-> "+st.peek()); st.pop(); System.out.println("new Top is-> "+st.peek()); } }的答案是什么?

问题:

[多选题]

public class StackTest {

public static void main(String[] args) {

Stack<Integer> st = new Stack<Integer>();

st.push(new Integer(11));

st.push(new Integer(22));

st.push(new Integer(33));

 

System.out.println("size is-> "+st.size());

System.out.println("Top is-> "+st.peek());

st.pop();

System.out.println("new Top is-> "+st.peek());

}

}

size is-> 3 Top is-> 33 new Top is-> 22
size is-> 4 Top is-> 33 new Top is-> 22

参考答案: size is-> 3 Top is-> 33 new Top is-> 22