Monday, 8 December 2014

Java : Collection Framework : Vector (Check the Size)

VectorExample.java
import java.util.Vector;

/*
 *  Example of size() method. 
 */
public class VectorExample
{
    public static void main( String[] args )
    {
        Vector<Integer> vector = new Vector<Integer>();

        vector.add(20);
        vector.add(30);
        vector.add(40);
        vector.add(50);

        System.out.println("vector  : " + vector + "\n");

        /*
         * Returns the number of components in this vector.
         */

        int size = vector.size();

        System.out.println("size  : " + size + "\n");

    }
}

Output
vector  : [20, 30, 40, 50]

size  : 4

To Download VectorDemoSize Project Click the below link

https://sites.google.com/site/javaee4321/java-collections/VectorDemoSize.zip?attredirects=0&d=1

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • 1 comment:

    1. Well, Thanks for your article.
      Its impressive to know something about your note on JAVA Applications. Please do share your articles like this your articles for our awareness. Mostly we do also provide JAVA Courses Online Training . For more info Contact-Us at@ Tectist.com.

      ReplyDelete