Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How does Vector implement synchronization?

Answer Posted / swamy

import java.util.Vector;

public class VectorExample {

public static void main(String[] args) {

Vector<String> vc=new Vector<String>();

// <E> Element type of Vector e.g. String, Integer, Object ...

// add vector elements
vc.add("Vector Element 1");
vc.add("Vector Element 2");
vc.add("Vector Element 3");
vc.add("Vector Element 4");
vc.add("Vector Element 5");

// add vector element at index
vc.add(3, "Element at fix position");

// vc.size() inform number of elements in Vector
System.out.println("Vector Size :"+vc.size());

// get elements of Vector
for(int i=0;i<vc.size();i++)
{
System.out.println("Vector Element "+i+" :"+vc.get(i));
}
}
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are annotations in java?

1043


Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?

1010


Why is multithreading important?

893


What is the difference between choice and list?

1052


Can we print null in java?

1015


Do loops java?

965


What is a Null object?

1535


What do you understand by a Static Variable?

1148


What is the main purpose of serialization in java?

982


What is the difference between the direct buffer and non-direct buffer in java?

987


What is Major and importance difference between for and foreach loop ?

1085


Can we execute a program without main() method?

995


What is the difference between preemptive scheduling and time slicing in java programming?

977


What is difference between printf and scanf?

1056


How do you escape a string?

921