3:42 pm - Thursday November 18, 9745

Vector Example Program for indexOf(Object o)

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:Coding for get the index value of a vector
 */
import java.util.Vector;

public class Index {
	public static void main(String[] args) {
		Vector v = new Vector();
		v.add("1");
		v.add("2");
		v.add("3");
		v.add("4");
		v.add("5");
		v.add("1");
		v.add("2");
		System.out.println(v.indexOf("1", 4));
		System.out.println(v.lastIndexOf("2", 5));
	}
}

Output:
5
1

Filed in: Z-A All Java Codes

Comments are closed.