Alshifa Hasnain has Published 283 Articles

What is the order of execution of non-static blocks with respect to a constructor in Java?

Alshifa Hasnain

Alshifa Hasnain

Updated on 26-Aug-2025 16:34:46

3K+ Views

In Java, non-static blocks run before the constructor whenever an object is created. If multiple non-static blocks exist, they execute in the order they appear in the class, followed by the constructor. In this article, we will understand this order of execution with the help of examples. What Are Non-Static ... Read More

Java program to shift array elements to the left

Alshifa Hasnain

Alshifa Hasnain

Updated on 07-Aug-2025 18:19:53

953 Views

What Is Left Shifting in an Array? Shifting the array elements to the left by the given number of positions is also known as left rotation of the array. The element at the beginning gets pushed out of the front during the shift, but instead of being deleted, they are ... Read More

Java program to shuffle an array using list

Alshifa Hasnain

Alshifa Hasnain

Updated on 07-Aug-2025 17:33:30

266 Views

In this article, we will learn how to shuffle an array using a list in Java. To do so, we will be using: Using Collections.shuffle() Method Using Fisher-Yates shuffle Using Java Streams Using Collections.shuffle() Method Shuffling ... Read More

Create Septet Tuple in Java

Alshifa Hasnain

Alshifa Hasnain

Updated on 28-Jul-2025 19:20:03

151 Views

Java does not have built-in tuple support; to use the tuple, we use the third-party library called Javatuples. This library provides classes representing fixed-size tuples of different sizes. The Septet class is one of these classes that represents a tuple with 7 values. Creating a Septet Tuple in Java We ... Read More

Create Pair Tuple in Java

Alshifa Hasnain

Alshifa Hasnain

Updated on 28-Jul-2025 15:29:41

318 Views

Java does not have built-in tuple support; to use the tuple, we use the third-party library called Javatuples. Using this library, you can create a tuple of different sizes, starting from a single-element tuple, which is the Unit class, up to a ten-element tuple (Decade class). The following is the ... Read More

Create Quartet Tuple in Java

Alshifa Hasnain

Alshifa Hasnain

Updated on 25-Jul-2025 19:09:22

161 Views

Java does not have built-in tuple support; to use the tuple, we use the third-party library called Javatuples. This library provides classes representing fixed-size tuples of different sizes. The Quartet class is one of these classes that represents a tuple with 4 values. Creating a Quartet Tuple in Java We can ... Read More

Count the number of columns in a MySQL table with Java

Alshifa Hasnain

Alshifa Hasnain

Updated on 15-Jul-2025 17:58:08

420 Views

In this article, we will learn how to count the number of columns in a MySQL table using JDBC. We will be using the ResultSetMetaData to get details of the table by using simple examples. What is ResultSetMetaData? The ResultSetMetaData is an interface that is present in the java.sql package. Using ... Read More

Add a value to Pair Tuple in Java

Alshifa Hasnain

Alshifa Hasnain

Updated on 15-Jul-2025 17:57:26

1K+ Views

By default, Java does not have built-in tuple support; to use the tuple, we use the third-party library called Javatuples. Using this library, you can create a tuple of different sizes, starting from a single-element tuple, which is the Unit class, up to a ten-element tuple (Decade class). The following ... Read More

Abstraction vs Encapsulation in Java

Alshifa Hasnain

Alshifa Hasnain

Updated on 14-Jul-2025 18:41:12

1K+ Views

Encapsulation Encapsulation is one of the four fundamental OOPs concepts. The other three are inheritance, polymorphism, and abstraction.Encapsulation in Java is a mechanism for wrapping the data (variables) and the code acting on the data (methods) together as a single unit. In encapsulation, the variables and methods within a class ... Read More

What are the new methods added to Process API in Java 9?

Alshifa Hasnain

Alshifa Hasnain

Updated on 14-Jul-2025 18:40:39

192 Views

In this article, we will learn about the new methods added to the Process API in Java 9. First, we will know about what is process API, and the methods in Process API in detail. What is Process API? In Java, the Process API, we can perform any operation regarding a ... Read More

1 2 3 4 5 ... 29 Next
Advertisements