1) What is Collection ?
Answer : Collection — the root of the collection hierarchy. A collection represents a group of objects known as its elements. The Java platform doesn't provide any direct implementations of this interface but provides implementations of more specific subinterfaces, such as Set and List.
è Set — A Set is a Collection that cannot contain duplicate elements. It models the mathematical set abstraction. The Set interface contains only methods inherited from Collection and adds the restriction that duplicate elements are prohibited.
Ø SortedSet — a Set that maintains its elements in ascending order.
è List — A List is an ordered Collection (sometimes called a sequence). Lists may contain duplicate elements.
Ø ArrayList - Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null.
Ø LinkedList
Ø Vector - The Vector class implements a growable array of objects. Like an array, it contains components that can be accessed using an integer index.
è Queue — A collection used to hold multiple elements prior to processing. Besides basic Collection operations, a Queue provides additional insertion, extraction, and inspection operations.
è Map — An object that maps keys to values. A Map cannot contain duplicate keys; each key can map to at most one value.
o SortedMap — A Map that maintains its mappings in ascending key order.
2) What is the difference between List, Set and Map?
Answer : A Set is a collection that has no duplicate elements. A List is a collection that has an order associated with its elements. A map is a way of storing key/value pairs. The way of storing a Map is similar to two-column table.
3) What is the difference between Vector and ArrayList ?
Answer : Vector is synchronized, ArrayList is not. Vector is having a constructor to specify the incremental capacity. But ArrayList don't have. By default Vector grows by 100% but ArrayList grows by 50% only.
4) What is the difference between Hashtable and HashMap ?
Answer : Hashtable is synchronized . but HashMap is not synchronized. Hashtable does not allow null values , but HashMap allows null values.
5) What is the difference between array and ArrayList ?
Answer : Array is collection of same data type. Array size is fixed, It cannot be expanded. But ArrayList is a growable collection of objects. ArrayList is a part of Collections Framework and can work with only objects.
6) What is any an anonymous class?
Answer : An anonymous class is a local class with no name.
7) What is the difference between synchronized block and synchronized method ?
3) What is the difference between Vector and ArrayList ?
Answer : Vector is synchronized, ArrayList is not. Vector is having a constructor to specify the incremental capacity. But ArrayList don't have. By default Vector grows by 100% but ArrayList grows by 50% only.
4) What is the difference between Hashtable and HashMap ?
Answer : Hashtable is synchronized . but HashMap is not synchronized. Hashtable does not allow null values , but HashMap allows null values.
5) What is the difference between array and ArrayList ?
Answer : Array is collection of same data type. Array size is fixed, It cannot be expanded. But ArrayList is a growable collection of objects. ArrayList is a part of Collections Framework and can work with only objects.
6) What is any an anonymous class?
Answer : An anonymous class is a local class with no name.
7) What is the difference between synchronized block and synchronized method ?
Answer : Synchronized blocks place locks for the specified block where as synchronized methods place locks for the entire method.
Casino site【FULL review & sign up bonus codes for
ReplyDeleteCasino site,【FULL review & sign up bonus codes for December luckyclub.live 2021】 - Grab your free bonus and see what you need to know! Rating: 4.5 · Review by LuckyClub