Aishwarya Naglot has Published 180 Articles

How to implement a constructor reference with one or more arguments in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 20-Aug-2025 12:24:21

9K+ Views

In this article, we are going to learn about implementing a constructor reference with an argument or multiple arguments in Java. Constructor references in Java provide us with a concise way of creating new objects via method references. These are going to enable us to reference a constructor without running ... Read More

How to create a constructor reference for an array in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 20-Aug-2025 12:22:04

4K+ Views

In Java, a constructor refers to a special method within a class that is always executed automatically while creating an instance of the class using the new keyword. Its main purpose is initializing the object by providing its fields with initial values so that it is ready for use. A ... Read More

Can an anonymous class have constructors in Java?

Aishwarya Naglot

Aishwarya Naglot

Updated on 08-Aug-2025 15:39:51

2K+ Views

Anonymous Classes in Java are classes that do not have a name. They are typically used to extend a class or implement an interface without the need for a separate named class. The following are the common uses of anonymous classes:Implementing event listeners.Creating Runnable objects for threads.Providing custom implementations for ... Read More

Class with a constructor to initialize instance variables in Java

Aishwarya Naglot

Aishwarya Naglot

Updated on 08-Aug-2025 15:09:08

12K+ Views

Constructors are special methods in Java that are invoked when an object is instantiated. They are typically used to initialize instance variables of a class. In this article, we will explore how to create a class with a constructor to initialize instance variables in Java. Creating a Class with a ... Read More

Java Program to Implement the queue data structure

Aishwarya Naglot

Aishwarya Naglot

Updated on 05-Aug-2025 16:36:12

3K+ Views

A Queue is a linear structure that follows a particular order in which the operations are performed. The order is First In, First Out (FIFO). In a queue, the element added first will be removed first. The end where elements are added is called the rear, and the end where ... Read More

Java Program to Check if a string contains a substring

Aishwarya Naglot

Aishwarya Naglot

Updated on 04-Aug-2025 18:51:48

3K+ Views

A string is a class in Java that stores a series of characters enclosed within double quotes, and a continuous sequence of characters within that string is known as a substring. Those characters are string-type objects. In this article, we will learn how to write Java programs to check ... Read More

Checking for Null or Empty in Java.

Aishwarya Naglot

Aishwarya Naglot

Updated on 04-Aug-2025 18:24:21

13K+ Views

A string is a collection of characters. In Java, it is represented by the String class, and it accepts NULL values. Checking for Null or Empty in Java In this article, we will learn if a string is null or empty in Java. The following are the ways to check if ... Read More

Java Program to Get the middle element of LinkedList in a single iteration

Aishwarya Naglot

Aishwarya Naglot

Updated on 04-Aug-2025 15:50:14

254 Views

The java.util.LinkedList class represents a linked list in Java, specifically a doubly-linked list, i.e., we can traverse through the list either from the beginning or from the end, whichever is closer to the specified index. We can create and perform various operations on a linked list using the methods provided ... Read More

Get Size of Java LinkedHashSet

Aishwarya Naglot

Aishwarya Naglot

Updated on 29-Jul-2025 18:49:52

379 Views

LinkedHashSet is a collection in Java that maintains the insertion order of elements. It is part of the Java Collections Framework and extends the HashSet class. It stores unique elements and allows null values, but only one null element. It is similar to HashSet; the main difference is that a ... Read More

Get an element from a Stack in Java without removing it

Aishwarya Naglot

Aishwarya Naglot

Updated on 29-Jul-2025 18:46:42

3K+ Views

The Stack is a data structure that is used to store elements in a Last In First Out (LIFO) manner. In Java, a stack is represented by the java.util.Stack class. It provides methods to create and manipulate a stack. Get an Element of a Stack without Removing it The pop() method ... Read More

Advertisements