????1.???
????????????????????????????????????????????????????????????к?????ó?????Java API?????????Stacck)??????????????????

 

package com.test.collections;
import java.util.Stack;
public class StackTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Stack<String> stack = new Stack<String>();
stack.add("China");
stack.add("Japan");
stack.add("Russia");
stack.add("England");
System.out.println(stack.size()+"<="+stack.capacity());
System.out.println(stack.elementAt(0));
System.out.println(stack.get(0));
System.out.println(stack.peek());
System.out.println(stack.push("France"));
System.out.println(stack.pop());
System.out.println(stack.iterator());
System.out.println(stack.empty());
System.out.println(stack.isEmpty());<br>??????????????????System.out.println(stack.search("Russia"));
}
}

????2.??н?
????Stack??????Vector????Vector??????AbstractList???????????List????Cloneable????RandomAcces??????Serializable????????????Vector????????????????ListItr??Itr??Itr????Vector?????????Iterator??????ListItr??????Itr??????????ListIterator????
????3.?????
???????Stack??????е??????pop()??peek()??push(Object)??search(Object)??empty()???????????????????Vector???ж?????????????????Vector?м??????????protected Object[] elementData??protected int elementCount;protected int capacityIncrement;private static final int MAX_ARRAY_SIZE = 2147483639;????????????????????Stack???????????????????elementData???????Stack?е????????elementCount????????????????????capacityIncrement????????Stack????????????????????????elementCount????MAX_ARRAY_SIZE ????????Stack????????????????