public
synchronized void addElement(E obj)
Adds
the specified component to the end of this vector.
import java.util.*; class VectorAddElement{ public static void main(String args[]){ Vector<Integer> myVector; myVector = new Vector<> (); /* Add Elements to myVector */ myVector.addElement(40); myVector.addElement(50); myVector.addElement(60); System.out.println("Elements in myVector are"); System.out.println(myVector); } }
Output
Elements in myVector are [40, 50, 60]
No comments:
Post a Comment