Stack Class : It is child class of vector It is specially designed class for last in first out order(LIFO) CONSTRUCTOR Stack s = new stack(); Operations: push(Object o) pop() offset peek()           s.search(A) //3 s.search(Z) ;//-1     Methods: Object push(Object obj):-For inserting an object to the stack. Object pop():-To […]

Read More →

Vector Class :  The underlying datastructure is resizable array or growable array.  Insertion order is preserved.  Duplicates objects are allowed.  Heterogeneous objects are allowed.  Null insertion is possible.  Vector implements Serializable, Cloneable interfaces and Random Access interfaces.  Vector is the best choice if our frequent operation is retrieval.  Linked List is the worst choice if […]

Read More →

ArrayList LinkedList 1. It is the best choice if our frequent operation is retrieval. 1. It is the best choice if our frequent operation is insertion and deletion in the middle. 2. ArrayList is the worst choice if our frequent operation is insertion or deletion in the middle. 2. LinkedList is the worst choice if […]

Read More →

LinkedList class :  The underlying datastructure is Double Linked List.  Insertion order is preserved.  Duplicates are allowed.  Heterogeneous objects are allowed.  Null insertion is possible.  Linked List implements serializable and cloneable interfaces but not Random Access interfaces.  Linked List is the best choice if our frequent operation is insertion or deletion in the middle.  Linked […]

Read More →

ArrayList class :  Resizable Array or growable array.  The underlined datastructure resizable and growable array.  Duplicates are allowed.  Insertion order is preserved.  Heterogeneous objects are allowed(Except Tree Set and Tree Map everywhere heterogeneous objects are allowed).  Null insertion is possible. CONSTRUCTOR: ArrayList l = new ArrayList():- Creates an empty ArrayList object with default initial capacity […]

Read More →

ArrayList and Vector both implements List interface and maintains insertion order. ArrayList Vector 1. Every method present in ArrayList is non-synchronized. 1. Every method present in ArrayList is synchronized. 2. At a time multiple threads are allowed to operate on ArrayList object and hence ArrayList is not thread safe. 2. At a time only one […]

Read More →

NEED OF COLLECTIONS: We have two approach: Individual variable approach: Array Individual variable approach: Suppose we want to create or store one int value in the memory. Like int x=10, here x is representing INT type value, now suppose I want to store one more value I will create another variable int y=10;So on and […]

Read More →

What is Object Oriented Programming ? It is style of programming in which a large application software is implemented in terms of independently programmable units of “data” (in the form of fields, often known as attributes) and “operations” or “codes” (in the form of procedures, often known as methods) called objects. BASIC ELEMENTS OF OOP […]

Read More →

What is Collections in java? A collection is simply an object that groups multiple elements into a single unit. Collections are used to store, retrieve, manipulate, and communicate aggregate data. Advantage : Collections are growable in nature i.e based on our requirement we can increase and decrease the size. Collections can hold both homogeneous and […]

Read More →

Difference between Array ad Collections(Or any collection class) ARRAYS COLLECTIONS 1.Arrays are fixed in size. 1.Collections are growbable in nature i.e based on requirement we can increase or decrease the size. 2. With respect to memory arrays are not recommended to use.   2. With respect to memory collections are recommended to use. 3. Arrays […]

Read More →