2:58 am - Friday July 20, 2018

Vector Example Program for lastElement()

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 last element of the vector
*/
import java.util.*;
class LastElement
{
 public static void main(String  args[])
  {
   Vector v=new Vector(); //creating vector object
   v.add("sam"); //adding the element into the vector object
   v.add("sugi");
   v.add("abi");
   System.out.println("the last element of the vector="+v.lastElement());//display the last element of the vector
  }
}

OUTPUT:

the last element of the vector is=abi

Filed in: Z-A All Java Codes

Comments are closed.