10:01 pm - Monday October 15, 2018

Vector Example Program for addElement(E obj)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
@AUTHOR:Candid java.com
@DESCRIPTION: Adds the specified component to the end of this vector, increasing its size by one
*/
import java.util.Vector;
public class AddElements
{
public static void main(String args[])
{
Vector v = new Vector();
for(int i = 0; i < 3; i++)
{
v.addElement(new Double(3));
}
for(int i = v.size() - 1; i >= 0; i--)
{
System.out.print(v.elementAt(i) + " ");
}
}
}

Output:
3.0 3.0 3.0

Filed in: Z-A All Java Codes

Comments are closed.