4:34 pm - Saturday September 23, 2017

Add an element to a Vector boolean add(E e)

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

BACK

                                  The public boolean add(E e) method Include the specified element to the end of  vector(e-element to be added to this vector).

Example program

import java.util.Vector;

public class vectorAdd 

{

	public static void main(String[] args)

	{

		Vector<Integer> h = new Vector<Integer>(7);

		h.add(5);

		h.add(10);

		h.add(15);

		for (Integer value : h)

		{

			System.out.println("Number:" + value);

		}
	}
}

Output

   Number:5

   Number:10

   Number:15

BACK

Filed in: Java Examples

Comments are closed.