Tech Tutorials
Tutorials and posts with code examples about Java, Spring, Angular, AI and many more.
- Website
- netjstech.com · all feeds from this site
- Feed URL
https://www.netjstech.com/feeds/posts/default?alt=rss
Read it in your FeedListing reader
Or add to: Feedly Inoreader Raw feed
Latest posts
-
String in Java Tutorial
String in Java is one of the most important and widely used classes in Java programming. Whether you're processing user input, reading files, working with APIs, or building enterprise applications, you'll frequently work with strings. A String represents a sequence of…
-
How to Compare Dates in Java: Date, Calendar, and LocalDate Examples
Comparing dates is a common requirement in Java applications, whether you need to validate user input, sort records chronologically, or calculate date-based conditions. In this tutorial we'll see how to compare dates in Java using both the legacy date-time classes (…
-
Palindrome Program Using Two Pointers in Java
In this tutorial, you'll learn how to write a Java program using two-pointers for the palindrome checking. The two-pointer technique is one of the most efficient approaches for determining whether a string reads the same forward and backward. A palindrome is a sequence of…
-
Generics in Java: Complete Guide with Examples and Benefits
Java has evolved significantly over the years, introducing powerful features such as Lambda Expressions , the Stream API , Records , Pattern Matching , Virtual Threads and many other enhancements. However, one of the most impactful additions to the language arrived much earlier,…
-
Three Dimensional Array (3D Array ) Java Example
In the previous tutorial on Arrays in Java , we introduced multidimensional arrays and explored how a 2D array can be used to store data in rows and columns. In this tutorial, we'll take the next step and learn about a 3D array in Java, including its declaration, initialization,…
-
Jagged Array in Java With Examples
Imagine you're storing data where every row doesn't need the same amount of information. Using a regular two-dimensional array would force you to allocate unnecessary space. This is where a Jagged Array in Java becomes useful. It’s also known as "ragged array". In this tutorial,…
-
Two Pointers Technique in DSA – A Complete Guide
The Two-Pointers technique is an algorithmic pattern used to solve problems involving linear data structures such as arrays, strings, and linked lists. Instead of repeatedly scanning the same elements using nested loops, the technique employs two variables (pointers) that move…
-
Find All Duplicates in an Array | Leetcode 442 | Java Program
In this article we’ll see how to write a Java program for the "Find All Duplicates in an Array" (Leetcode 442) problem. Problem Statement: Given an integer array nums of length n, where every element is in the range [1, n] and each value appears either once or twice, return all…
-
Cyclic Sort Java Program
The Cyclic Sort is an efficient in-place sorting algorithm specifically designed for arrays containing distinct numbers within a known, fixed range (typically from 1 to n or 0 to n, where n is the length of the array). Unlike traditional comparison-based sorting algorithms such…
-
Remove Duplicate Elements From an Array in Java
Write a Java program to remove duplicate elements from an array is a frequently asked interview question . Depending on the interview scenario, you may be asked to remove duplicates using the Java Collection Framework, solve the problem without using any collection classes such…
-
Java Program to Find Duplicate Elements in an Array
If you have to write a Java program to find duplicate elements in an array, several approaches can be used depending on the performance requirements of the application. The most straightforward solution is to compare every array element with all the remaining elements. Although…
-
Kadane’s Algorithm - Maximum Subarray Sum Java Program
Kadane’s Algorithm is an efficient method used to find the maximum sum of a contiguous subarray. In this tutorial we’ll explore how to implement Kadane’s algorithm in Java. Problem Statement Given an integer array arr[] containing both positive and negative numbers, find the…
-
Java Program to Find Largest and Smallest Number in an Array
In this tutorial, we will write a find largest and smallest number in a given array Java program without using any built-in sorting methods or additional data structures. In other words, the objective is to find the maximum and minimum elements in an array using a single pass…
-
Java Program to Find Largest and Second Largest Number in an Array
In this tutorial, we will learn how to write a find largest and second largest number in given array Java program without using any built-in sorting methods or additional data structures. This is a popular Java interview question that tests your understanding of arrays,…
-
Java Program to Find the Second Largest Element in an Array
In this article we'll learn how to write a Java program to find the second largest element in an array using multiple approaches. This is a common array-based problem frequently asked in Java interviews and coding assessments because it tests your understanding of array…
-
Java Program to Find the Largest Element in an Array
In this article we'll learn how to write a Java program to find the largest element in an array using multiple approaches. Finding the maximum value in an array is a common programming task and is frequently asked in coding interviews. For example: Input: arr = {4, 7, 8, 0, 4,…
-
TimSort Algorithm Java Program
Timsort is a hybrid, stable, and adaptive sorting algorithm that combines the strengths of Insertion Sort and Merge Sort . It was specifically designed to perform exceptionally well on real world data, where elements are often partially sorted rather than completely random. The…
-
Java Stream API Examples - Learn By Practice
In the post Java Stream API Tutorial , we introduced the fundamentals of the Stream API and its role in functional style programming. In this article, we'll explore several Java Stream API Examples that demonstrate how to process data efficiently using common stream operations.…
-
Java Program - Minimum Spanning Tree - Kruskal's Algorithm
In this article, you'll learn how to write a Java program for Kruskal's algorithm to find the Minimum Spanning Tree (MST) of a connected, weighted, and undirected graph. What Is a Minimum Spanning Tree A Minimum Spanning Tree (MST) of a weighted, undirected graph is a subset of…
-
Insertion Sort Program in Java
In this tutorial, you'll learn how to write an Insertion Sort program in Java, understand how the algorithm works, analyze its time and space complexity, and walk through a detailed example. Insertion Sort is one of the simplest comparison-based sorting algorithms and is…