debstui das
vector prblem
1 Answer(s)      4 years and a month ago
Posted in : Java Beginners

View Answers

May 14, 2009 at 11:27 AM


Hi Friend,

Try the following code:

import java.util.*;

public class VectorDemo{
static int index = 1;
static int count=5;
static boolean moreNumbers = true;
static Vector list = null;
static Scanner sc = new Scanner(System.in);

public static void main(String args[]){
System.out.println("Input list of 5 items: ");
list = new Vector(count);
while(moreNumbers && index <=count){
list.add(sc.next());
index++;
}
System.out.println("Elements of Vector: " +list);
}
}

Thanks









Related Pages:
vector prblem - Java Beginners
vector prblem  a java program that will accept a shopping list of 5...; static Vector list = null; static Scanner sc = new Scanner(System.in); public...: "); list = new Vector(count); while(moreNumbers && index <=count){ list.add
vector question
vector question  how does vector works?   Please visit the following link: Java Vector Demo
ArrayList and Vector
ArrayList and Vector  hello, Why ArrayList is faster than Vector?   hii, ArrayList is faster than Vector, because ArrayList is not synchronized. Synchronization will reduce the performance of Vector
arraylist and vector
arraylist and vector  what is the diff b/w arraylist and vector
vector and arraylist
vector and arraylist    suppose i have class A { public static arrylist a1(){} class B{ public static vector b1() {} } my question is how to class B method in Class A and how to get vector object values in class A without
Vector object[]
Vector object[]  I want to create payslip in java public Vector createData() { Vector result = new Vector(); Vector rec = new Vector... Olsen"}; rec.add(value); result.add(rec); rec = new Vector
Java Vector
Java Vector       Vector represents a collection of similar items. In Java, the Vector class is defined..., its items can be accessed using an integer index. Once the Vector has been
Vector in java
Vector in java Vector in java implements dynamic array. It is similar to array and the component of vector is accessed by using integer index. Size of vector can grow or shrink as needed, by adding and removing item from vector
vector - Java Interview Questions
Vector Class in Java  What is a Java Vector Class?  Hi friend,Read for more information,http://www.roseindia.net/java/beginners/vectordemo.shtml
Vector in Java
Vector in Java are array lists that are used instead of arrays, as they have... data even after the Vector has been created. Capacity of vector is always to the lowest degree. Size of the Vector is however larger because components
Java collection Vector
Java collection Vector  How can we use the vector class in java program?   The vector class is similar to the ArrayList class except that the vector class is synchronized. import java.util.Iterator; import
vector object - Java Beginners
vector object  hi i have created a Vector vec=new Vector(); vec.addElement(o); o is an object of group(acl.group) what i have to do to read contents of this object? can it be possible to convert it into string arrays
vector - Java Beginners
vector  is it possible to identify the size of the vector by using length,length()  Why u want to use length and length()? Size method is there to find number of elements in vector
Diff between ArrayList and Vector?
Diff between ArrayList and Vector?  What's The Difference between ArrayList and Vector Classes and Can you give me a simple Program for set and List Interface
Java Vector
Java Vector In this tutorial, you will learn about vector and its' implementation with example. Vector is alike to ArrayList , it is also dynamic... : Vector is synchronized  Vectors are still using methods which
VECTOR - Java Interview Questions
VECTOR  How to write our own vector i want source code?  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/vectordemo.shtml Hope that it will be helpful for you. Thanks
problem with Vector elemenAt()::ArrayIndexOutofBoundsException
problem with Vector elemenAt()::ArrayIndexOutofBoundsException  Hi, I am execute a query and add resultset data to a vector like bellow try... from that vector as bellow:: for (int ni = 0; ni < statename.size(); ni
Java Vector
Java Vector       Introduction to Vector Vector are array list with extended properties which follow the dynamic and automatic addition of data at run-time. Unlike array, Vector
What is a vector in Java? Explain with example.
What is a vector in Java? Explain with example.  What is a vector in Java? Explain with example.   Hi, The Vector is a collect of Object... when required. There are 2 types of Vector i.e. synchronized and Vector contains
An application using swings and vector methods
An application using swings and vector methods   Hi, I want an application in Java swings which uses good selection of Vectors methods
Vector Iterator Java Example
Vector is a collection class.It works similar to the Array. It has... interface can traverse all its elements. Java Vector Iterator with Example import java.util.Iterator; import java.util.Vector; public class vector
Java : Vector Example
Java : Vector Example This segment of tutorial illustrates about the Vector class and its use with the Iterator interface. Java Vector : Vector class... it different to it as -Vector is synchronized and it contain many methods
Old and New Vector Methods
Java: Old and New Vector Methods When the new Collections API was introduced in Java 2 to provide uniform data structure classes, the Vector class... a Vector (eg, ArrayList, or LinkedList, your other code will not need to change
arraylist vs vector - Java Beginners
arraylist vs vector  hi, i want to know what is the difference between arraylist and vector in case of performance. in what cases we should go for arraylist and in what case we should go for vector. is there any   array
Convert Array to Vector
Convert Array to Vector       In this section, you will learn to convert an Array to Vector... into a Vector. Here we have taken an array of data which gets converted to data
Convert Vector to Array
Convert Vector to Array       In this section, you will learn to convert Vector to an Array.  Code Description: This program helps you in converting Vector to an Array. Here
J2ME Vector Example
J2ME Vector Example       This application illustrates how we can use Vector class. In this example we are using  the vector class in the canvas form. The vector class
Java Vector Iterator
Java Vector Iterator is a Collection class. It has similar functionality... all its elements. Java Vector Iterator Example import java.util.Iterator...(String[] args) { Vector v = new Vector(); String tree[] = { "olive", "oak
Convert array to Vector
Convert array to Vector       In this section we will learn how to convert an array to vector. Actually array is used is used to store similar data types but Vector is used
Photoshop Vector Simplicity Tutorial
org.htmlparser.util.ParserException: C:\downloadingarticles\websitereader\Vector Simplicity (The system cannot find the file specified
How to Define Vector Iterator in Java Program
How to Define Vector Iterator in Java Program  Hi, I want to develop a small application where i want to define vector iterator in my Java Programming. Kindly Suggest any online reference for references. Thanks
what is diference between the vector and arraylist with realtime example - Java Interview Questions
what is diference between the vector and arraylist with realtime example  what is diference between the vector and arraylist with realtime example  Hi Friend, Difference between Vector and ArrayList: 1)Vector
write a program to create an vector and listeterator.and value should be enter through keyboard.
write a program to create an vector and listeterator.and value should be enter through keyboard.  write a program to create an vector and listeterator.and value should be enter through keyboard
write a program to create an vector and listeterator.and value should be enter through keyboard.
write a program to create an vector and listeterator.and value should be enter through keyboard.  write a program to create an vector and listeterator.and value should be enter through keyboard
write a program to create an vector and listeterator.and value should be enter through keyboard.
write a program to create an vector and listeterator.and value should be enter through keyboard.  write a program to create an vector and listeterator.and value should be enter through keyboard
Java Notes: Vectors
secure in a multithreaded environment. The Vector class was changed in Java 2... to use each. The description below is for the (new) Vector class. Vectors can... a primitive type in a Vector, put it inside an object (eg, to save an integer value use
Sorting Vector Element using I18N
Sorting Vector Element using I18N       This Example shows you how to sort vector element using I18N.... Methods used in this example are described below : Vector.add() : Vector is like
write a program to create an vector with string(add,remove) operation.and value should be enter through keyboard.
write a program to create an vector with string(add,remove) operation.and value should be enter through keyboard.  write a program to create an vector with string(add,remove) operation.and value should be enter through keyboard
Vector Example in java
Vector Example in java     ... of java.util.Vector class. We will be creating an object of Vector class and performs various operation like adding, removing etc. Vector class extends AbstractList
Open Source Vector
Open Source Vector Open source vector graphics The open source Xara Xtreme project -- which is building a commercial-standard vector graphics program... to an official 1.0 release. An example of a commercial-standard vector graphics
Vector Linux - SOHO final 5.1 is Released
Vector Linux - SOHO final 5.1 is Released The SOHO edition of ... control. VectorLinux SOHO-5.1 is at the door.The Vector development team... of Vector is intended for the small office/home office user with a complete desktop
V - Java Terms
V - Java Terms       Java Vector Vector represents a collection of similar items. In Java, the Vector class is defined in java.util package
Java Interview Questions - Page 6
Java Interview Questions - Page 6       Question:  What is the Vector class? Answer: The Vector class provides the capability to implement
VectorLinux 5.1 Live RC1 is available
VectorLinux 5.1 Live RC1 is available The first release candidate of the Standard edition of Vector Linux 5.1 Live is now available for download and testing... the Vector Linux VECTORLINUX is a small, fast, Linux operating system for Intel
The BitSet class
The BitSet class The BitSet class creates dynamic array which can holds bit values and can increase its size when needed. So its like vector of bit. It supports two type of constructor : (1) The first constructor creates a default
collections
collections  Diff bet add() and addElement() in Vector
collections
collections  Diff bet add() and addElement() in Vector

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.