ABCDEFGHIJKLMNOPQRST
1
77,What is Collection API?,The Collection API is a set of classes and interfaces that support operation on collections objects. such as HashMap, ArrayList, LinkedList, Collection, Set, List and Map.,,The Collection API is a set of classes and interfaces that support operation on collections of objects. These classes and interfaces are more flexible, more powerful, and more regular than the vectors, arrays, and hashtables if effectively replaces.

Example of classes: HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap.

Example of interfaces: Collection, Set, List and Map.
2
78,What is an Iterator?,The Iterator interface is used to step through the elements of a Collection.,,Some of the collection classes provide traversal of their contents via a java.util.Iterator interface. This interface allows you to walk through a collection of objects, operating on each object in turn. Remember when using Iterators that they contain a snapshot of the collection at the time the Iterator was obtained; generally it is not advisable to modify the collection itself while traversing an Iterator.
3
79,What is an Iterator interface?,The Iterator interface is used to step through the elements of a Collection.,,The Iterator interface is used to step through the elements of a Collection.
4
80,What is the List interface?,The List interface provides support for ordered collections of objects.,,The List interface provides support for ordered collections of objects.
5
81,What is the Set interface?,The Set interface provides methods for accessing the elements of a finite mathematical set. Sets do not allow duplicate elements.,,The Set interface provides methods for accessing the elements of a finite mathematical set. Sets do not allow duplicate elements.
6
82,Is Iterator a Class or Interface? What is its use?,The Iterator interface is used to step through the elements of a Collection.,,Iterator is an interface which is used to step through the elements of a Collection.
7
83,What is the Vector class?,The Vector class provides the capability to implement a growable array of objects,,The Vector class provides the capability to implement a growable array of objects
8
84,What is HashMap and Map?,Map is Interface and Hashmap is class that implements that.,,Map is Interface and Hashmap is class that implements that.
9
85,Difference between Vector and ArrayList?,1) Synchronization - ArrayList is not thread-safe whereas Vector is thread-safe. In Vector class each method like add(), get(int i) is surrounded with a synchronized block and thus making Vector class thread-safe.
2) Data growth - Internally, both the ArrayList and Vector hold onto their contents using an Array. When an element is inserted into an ArrayList or a Vector, the object will need to expand its internal array if it runs out of room. A Vector defaults to doubling the size of its array, while the ArrayList increases its array size by 50 percent.
,,Vector is synchronized whereas arraylist is not
10
86,What is the Map interface?,The Map interface is used associate keys with values.,,The Map interface replaces the JDK 1.1 Dictionary class and is used associate keys with values.
11
87,Difference between HashMap and HashTable?,Both collections implement Map. and Both collections store value as key-value pairs.
The key differences between the two are
1. Hashmap is not synchronized in nature but hashtable is.
2. HashMap’s iterator is fail-safe but Hashtable’s enumerator isn’t
3. HashMap permits null values and only one null key, while Hashtable doesn't allow key or value as null.
,,The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls. (HashMap allows null values as key and value whereas Hashtable doesnt allow). HashMap does not guarantee that the order of the map will remain constant over time. HashMap is unsynchronized and Hashtable is synchronized.
12
88,What are wrapped classes?,Wrapped classes are classes that allow primitive types to be accessed as objects.,,Wrapped classes are classes that allow primitive types to be accessed as objects.
13
89,Why do we need wrapper classes?,The wrapper classes provide many utility methods, and most of the collection classes store objects and not primitive data types.,,It is sometimes easier to deal with primitives as objects. Moreover most of the collection classes store objects and not primitive data types. And also the wrapper classes provide many utility methods also. Because of these reasons we need wrapper classes. And since we create instances of these classes we can store them in any of the collection classes and pass them around as a collection. Also we can pass them around as method parameters where a method expects an object.
14
90,Is string a wrapper class?,String is a primitive type class, but not a wrapper class.,,String is a class, but not a wrapper class. Wrapper classes like (Integer) exist for each primitive type. They can be used to convert a primitive data value into an object, and vice-versa.
15
91,Name the eight primitive Java types?,The eight primitive types are byte, char, short, int, long, float, double, and boolean.,,The eight primitive types are byte, char, short, int, long, float, double, and boolean.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100