11:11 pm - Sunday July 15, 2018

Vector Example Program for remove(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: remove(int index) is used to Removes the element at the specified position in this Vector.
*/
import java.util.*;
public class DeeRemoveVector
{
public static void main(String[] args) throws Exception
{
try{
Vector v=new Vector();//create the vector
v.add("c");//add the elements
v.add("a");//add the elements
v.add("n");//add the elements
v.add("d");//add the elements
v.add("i");//add the elements
v.add("d");//add the elements
System.out.println("the elements is: "+v);//to print the given elements
System.out.print("removed element is: ");
System.out.println(v.remove(2));//specified elements is removed and print the element
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}

output
the elements is:


removed element is: n


Filed in: Z-A All Java Codes

Comments are closed.