Skip to content

Category Archives: Java

An Interface in Java programming language is defined as an abstract type used to specify the behavior of a class. An interface in Java is… Read More
A PriorityQueue is used when the objects are supposed to be processed based on the priority. It is known that a Queue follows the First-In-First-Out… Read More
Multi-threaded programs may often come to a situation where multiple threads try to access the same resources and finally produce erroneous and unforeseen results.  Why… Read More
Using Java in competitive programming is not something many people would suggest just because of its slow input and output, and well indeed it is… Read More
StringBuffer is a class in Java that represents a mutable sequence of characters. It provides an alternative to the immutable String class, allowing you to… Read More
Try to figure out the output of this code: public class Test {     public static void main(String[] args)     {         System.out.println(45+5 + "=" +45+5);     } }… Read More
Consider the below Java program. // A Java program with overloaded main() import*;    public class Test {            // Normal main()     public static… Read More
Annotations are used to provide supplemental information about a program.  Annotations start with ‘@’. Annotations do not change the action of a compiled program. Annotations… Read More
All data structure has their own special characteristics, for example, a BST is used when quick searching of an element (in log(n)) is required. A… Read More
Before Java 7, we had to catch only one exception type in each catch block. So, whenever we needed to handle more than one specific… Read More
Many programming contest problems are somehow related Prime Numbers. Either we are required to check Prime Numbers, or we are asked to perform certain functions… Read More
In Java, Scanner and BufferedReader class are sources that serve as ways of reading inputs. Scanner class is a simple text scanner that can parse… Read More
A comparator interface is used to order the objects of user-defined classes. A comparator object is capable of comparing two objects of the same class.… Read More
  Singleton Design Pattern | IntroductionThe singleton pattern is one of the simplest design patterns. Sometimes we need to have only one instance of our… Read More
Using volatile is yet another way (like synchronized, atomic wrapper) of making class thread-safe. Thread-safe means that a method or class instance can be used… Read More