Turn Desktop View Off
by Dinesh Thakur Category: array

Strings often used in programming. Most of the programs use strings such as names, addresses, messages and many more. A string is a sequence of Unicode characters. Unlike most of the programming languages such as C/C++ where strings treated as an array of characters, Java treats a string as an object. Java provides the following classes for storing and processing strings.

 
by Dinesh Thakur Category: array

Before using the element of an array, it must have an initial value. In some programming languages ​​do not set initial values default, and then when trying to access to an item an error occurs. In Java, all the variables, including the elements array have initial default value (default initial value). This default initial value is equal to 0 in numeric types or equivalent types (eg null for objects and false for boolean).

 
by Dinesh Thakur Category: array

In Java arrays have a fixed length that is specified during initialization, and determines the number of its elements. Once we set the length of the array is not possible to change it.

 
by Dinesh Thakur Category: array

The Vector object store objects of any kind are extremely  although flexible operations on objects of this class are slower than  operations on common vectors (arrays). The capacity of the vector is the maximum amount of  elements that it can hold at a given instant. Its size corresponds to  number of elements actually stored. Having your whole capacity occupied  (size = capacity), adding a new element causes the automatic increase  capacity vector. If an increment is specified via its constructor, this increase occurs with this granularity, otherwise the capacity is doubled.

 
by Dinesh Thakur Category: array
 
by Dinesh Thakur Category: array

When we want to enter details of several students or workers or patients, then instead of making separate objects by different names, it is better to make an array of object of that class. By making an array of object, we can take the advantage of loops to feed and retrieve data.

 
by Dinesh Thakur Category: array
 
by Dinesh Thakur Category: array
 
by Dinesh Thakur Category: array

Insertion and deletion at the beginning of a linked list are very fast. They involve changing only one or two references, which takes 0(1) time. Finding, deleting, or insertion next to a specific item requires searching through, on the average, half the items in the list. This requires O(n) comparisons. An array is also O(n) for these operations, but the linked list is nevertheless faster because nothing needs to be moved when an item is inserted or deleted.

 
by Dinesh Thakur Category: array

A linked list refers to a collection of nodes connected to each other with the help of a link. Each link object contains a reference usually called next to the next link in the list. Although an array is a common way of storing data elements, but inserting an element in between an array or deleting an element from an array requires a lot of shuffling of other array elements.

 
by Dinesh Thakur Category: array

The elements() method of the Vector class is used to retrieve an enumeration of the elements that were added to the vector. A while loop is then used to cycle through and print the elements contained in the enumeration. The hasMoreElements() method is used to determine whether the enumeration contains more elements. If it does, the nextElement() method is used to retrieve the object for printing.

 
by Dinesh Thakur Category: array

The Vector class provides the capability to implement a growable array. The array grows larger as more elements are added to it. The array may also be reduced in size, after some of its elements have been deleted. This is accomplished using the trimToSize() method.

 
by Dinesh Thakur Category: array

StringBuffer represents grow able and write able character sequences. We can modify the StringBuffer object, i.e. we can append more characters or may insert a substring in middle. StringBuffer will automatically grow to make room for such additions and is very flexible to the modifications.

 

Page 1 of 5



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles