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 is java virtual machine and how it is considered in context of java’s platform independent feature?

1160


Explain, java is compatible with all servers but not all browsers?

1051


Hi.... I applied for the post of scientific officer/Engineer-SB(Programmer).Please post the syllabus and sample papers.

1993


What will be the initial value of an object reference which is defined as an instance variable?

1127


Explain restrictions for using anonymous inner classes?

1079


what is a thread pool in java and why is it used?

990


Why pass by reference is not possible in java?

1024


What are java annotations?

1141


How do you declare an empty string?

1056


Can I extend singleton class in java?

1091


Distinguish between a predicate and a function?

981


Explain where variables are created in memory?

1004


What is object english?

1051


How is tree Mirroring implemented?

1063


How do you check whether the list is empty or not in java?

971