Skip to content

Category Archives: Java

Consider the below Java program.Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of… 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 its own special characteristics, for example, a BST is used when quick searching of an element (in log(n)) is required. A… Read More
Background Prior to Java 7, we had to catch only one exception type in each catch block. So whenever we needed to handle more than… 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
java.util.Scanner class is a simple text scanner which can parse primitive types and strings. It internally uses regular expressions to read different types.  Attention reader!… 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… Read More
There is a rule that every member of interface is only and only public whether you define or not. So when we define the method… Read More
We can declare interfaces as member of a class or another interface. Such an interface is called as member interface or nested interface. Interface in… Read More
Java doesn’t support multi-value returns. We can use following solutions to return multiple values.  Attention reader! Don’t stop learning now. Get hold of all the… Read More
In Java, if there is a local variable in a method with same name as instance variable, then the local variable hides the instance variable.… Read More
We know that a Java code begins to execute from the main method. During runtime, if JVM can’t find any main method then we will… Read More
Consider following program. Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java… Read More