3:50 pm - Wednesday February 19, 1496

Vector Example Program for removeElementAt(int index)

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: candidjava
@description: removeElementAt(int index) is used to Deletes the component at the specified index and return new elements
 */
import java.util.*;

public class DeeRemoveElementAtVector {
	public static void main(String[] args) {
		Vector v = new Vector();// create the vector
		v.add('d');// add the elements
		v.add('e'); // add the elements
		v.add('e'); // add the elements
		v.add('p'); // add the elements
		v.add('a'); // add the elements
		v.add('n'); // add the elements
		System.out.println("the elements are: " + v);// to print the vector
							// elements
		v.removeElementAt(3);// to remove 3rd position element
		System.out.println("after removed");
		System.out.println("the new elements are: " + v);// to print new
								// elements
	}
}


output
the elements are: [d, e, e, p, a, n]
after removed
the new elements are: [d, e, e, a, n]

Filed in: Z-A All Java Codes

Comments are closed.