JAVA Tutorials

Multi Threading in Java : Free Java Tutorials and Online Training

Multitasking – The objective of multitasking is to execute multiple tasks simultaneously to reduce CPU response time and make program execution faster and improve overall system performance. In Java we have multi processing and multi threading. It can be achieved in two ways: 1) Process-based Multitasking (multi-processing) In multi-processing, each task that is being concurrently executed …

Multi Threading in Java : Free Java Tutorials and Online Training Read More »

LinkedHashMap, IdentityHashMap and WeakHashMap : Free Java Tutorials

LinkedHashMap LinkedHashMap is the child class of HashMap. It is exactly same as HashMap (including methods and constructors) except the following   differences: LinkedHashSet and LinkedHashMap are commonly used for developing cache based applications. Let us take a programming example of LinkedHashMap : import java.util.*; class LinkedHashDemo { public static void main(String args[]) { LinkedHashMap lh …

LinkedHashMap, IdentityHashMap and WeakHashMap : Free Java Tutorials Read More »

Comparable and Comparator Difference : Free Java Tutorials

For predefined comparable classes (String) default natural sorting order already available. If we are not satisfied with that default natural sorting order, then we can define our own sorting by using Comparator Interface. For predefined non comparable classes StringBuffer default natural sorting order not already available, we can define our own sorting technique by using …

Comparable and Comparator Difference : Free Java Tutorials Read More »

MAP, Entry and HashMap – Free Java Tutorials and Online Training

If we want to represent a group of object as key-value pairs. then we have to use MAP. Key-value pairs means, for every value there will be a unique key. MAP MAP Features Both keys and values are objects only. Duplicate keys are not allowed, but duplicate values are allowed. Each key-value pair is called Entry, …

MAP, Entry and HashMap – Free Java Tutorials and Online Training Read More »

String Objects in TreeSet – Free Java Tutorials and online Training

Let us take some programming examples based on String objects in TreeSet concept : Example1 : Write a JAVA Program to insert String Objects into a TreeSet where all elements should be inserted according to reverse of alphabetical order. import java.util.*; class myComp implements Comparator // Our custom comparator class { public int compare(Object obj1, Object …

String Objects in TreeSet – Free Java Tutorials and online Training Read More »