Comparable and Comparator in Java Example
Comparable and Comparator in Java are very useful for sorting collection of objects. Java provides some inbuilt methods to sort primitive types array or Wrapper classes array or list. Here…
Comparable and Comparator in Java are very useful for sorting collection of objects. Java provides some inbuilt methods to sort primitive types array or Wrapper classes array or list. Here…
A queue is a first-in, first-out data structure. Elements are appended to the end of the queue and are removed from the beginning of the queue. In a priority queue,…
Java HashMap is HashTable based implementation of Map. This is the reason why interviewer always asks for the difference between HashMap and HashTable. HashMap is mostly equaled to HashTable except…
HashSet The HashSet class implements the Set interface, backed by a hash table which is actually a HashMap instance. No guarantee is made as to the iteration order of the…
Java TreeSet Introduction TreeSet is one of the most important implementations of the SortedSet interface in Java that uses a Tree for storage. The ordering of the elements is maintained…
Strings Strings, which are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects. The Java platform provides the String class to create and…
By implementing the Runnable interface we can start a new thread, but unfortunately, this method doesn't return a value. So if we want the thread to have return value then…
Immutable Objects An object is considered immutable if its state cannot change after it is constructed. Maximum reliance on immutable objects is widely accepted as a sound strategy for creating…
In this article, you will learn What Is The Exception In Java Java Exception Handler Java Exception Hierarchy Java Exception Type try-catch-finally throws/throw keyword Java 7 Automatic Resource Management and…
自动装箱(autoboxing)是指 Java 编译器自动将基本数据类型值转换成对应的包装类的对象,例如将 int 转换为 Integer 对象,将 boolean 转换问 Boolean 对象。而拆箱(unboxing)则是反过来转换。 基本数据类型及其包装类的对应 以下这些基本数据类型都有对应的包装类 基本数据类型 包装类 boolean Boolean byte Byte char Character float Float int Integer long Long short Short double…