Skip to content

Category Archives: Java

Prerequisite: Collection in Java Following are the 4 ways to retrieve any elements from a collection object:   For-each For each loop is meant for traversing items… Read More
A new feature was introduced by JDK 7 which allows writing numeric literals using the underscore character. Basically, they are broken to enhance readability. This feature… Read More
In JDK 5, Java has included a feature that simplifies the creation of methods that need to take a variable number of arguments. This feature… Read More
Reflection is an API which is used to examine or modify the behavior of methods, classes, interfaces at runtime. The required classes for reflection are… Read More
String is a sequence of characters. In java, objects of String are immutable which means a constant and cannot be changed once created. Creating a… Read More
Background : Iterator is an interface provided by collection framework to traverse a collection and for a sequential access of items in the collection.   // Iterating… Read More
This is a question asked quite often as in which language should be preferred to be efficient in competitive programming. It is something one should… Read More
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… Read More
Consider 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 Java… Read More
An assertion allows testing the correctness of any assumptions that have been made in the program. Assertion is achieved using the assert statement in Java.… Read More
Any group of individual objects which are represented as a single unit is known as the collection of the objects. In Java, a separate framework… Read More
In C++, we have std::pair in the utility library which is of immense use if we want to keep a pair of values together. We… Read More
  Why is Java called the ‘Platform Independent Programming Language’?   Platform independence means that execution of your program does not dependent on type of… Read More
Generics mean parameterized types. The idea is to allow type (Integer, String, … etc, and user-defined types) to be a parameter to methods, classes, and… Read More
Introduction In C/C++, programmer is responsible for both creation and destruction of objects. Usually programmer neglects destruction of useless objects. Due to this negligence, at… Read More