9:05 pm - Saturday April 20, 2019

Vector Example Program for firstElement()

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
@DESCRIPTION: coding  for  get the first element from the vector
 */

import java.util.*;

public class FirstElement {
	public static void main(String args[]) {
		Vector v = new Vector(); // creating vector object
		v.add("sam");
		v.add("sugi");
		v.add("abi");
		System.out.println("the first element of the vector="
				+ v.firstElement());// display the first element of the vector
	}
}

OUTPUT:
the first element of the vector is=sam

Filed in: Z-A All Java Codes

Comments are closed.