Shah Chunky  Sun Certified Java2 Programmer.
Associate Instructor  Hofstra University
Amazon Top 750 reviewer  Blog  Unresolved References  Book Review Blog
Originally posted by sai challa:
Regarding your first question:
the constructor Vector(int capacity,int increment) creates a Vector object with an initial capacity of 'capacity' and the capacity will be increased by 'increment' elements each time more space is needed.
In your case a Vector object is created initially with a capacity of 5 and when a sixth element is to be added it's capacity is incremented by 10 i.e 5+10=15 .Hence the answer is 3.
Vector
public Vector(int initialCapacity,
int capacityIncrement)
Constructs an empty vector with the specified initial capacity and capacity increment.
Parameters:
initialCapacity  the initial capacity of the vector.
capacityIncrement  the amount by which the capacity is increased when the vector overflows.
Throws:
IllegalArgumentException  if the specified initial capacity is negative
public abstract interface Set
extends Collection
A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element. As implied by its name, this interface models the mathematical set abstraction.

public abstract interface SortedSet
extends Set
A set that further guarantees that its iterator will traverse the set in ascending element order, sorted according to the natural ordering of its elements (see Comparable), or by a Comparator provided at sorted set creation time. Several additional operations are provided to take advantage of the ordering. (This interface is the set analogue of SortedMap.)
public abstract interface Map
An object that maps keys to values. A map cannot contain duplicate keys; each key can map to at most one value.

public abstract interface SortedMap
extends Map
A map that further guarantees that it will be in ascending key order, sorted according to the natural ordering of its keys (see the Comparable interface), or by a comparator provided at sorted map creation time. This order is reflected when iterating over the sorted map's collection views (returned by the entrySet, keySet and values methods). Several additional operations are provided to take advantage of the ordering. (This interface is the map analogue of the SortedSet interface.)
Shah Chunky  Sun Certified Java2 Programmer.
Ever since I found this suit I've felt strange new needs. And a tiny ad:
Free, earth friendly heat  from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/freeheat
