java 中的栈中的push方法和add方法有什么区别

如题所述

这两个方法最大的区别就是返回值不一样,在作用上基本没有区别。 add是实现List接口重写的方法,返回值为boolean。 addElement是Vector类中的特有方法,返回值是void
温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-08-26
push(E item)
Pushes an item onto the top of this stack.

public boolean add(E e)

Appends the specified element to the end of this Vector.本回答被网友采纳
相似回答