3:10 am - Friday July 20, 2018

Vector Example Program for isEmpty()

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 checking the object?s equality
*/

import java.util.Vector;
public class DeeIsEmpty
{
   public static void main(String[] args)
    {
      Vector vec = new Vector(4); //creating a vector object
      System.out.println("The vector is empty: "+vec.isEmpty());  //checking the vector is empty or not
      vec.add(4); //to add an element to the vector object
      vec.add(3);
      vec.add(2);
      vec.add(1);
      System.out.println("The vector is empty: "+vec.isEmpty());//checking the vector is empty or not
   }
}

OUTPUT:
The vector is empty: true
The vector is empty: false

Filed in: Z-A All Java Codes

Comments are closed.