Java program to delete a node from the beginning of the Circular Linked List17 Mar 2025 | 3 min read In this program, we will create a circular linked list and delete a node from the beginning of the list. If the list is empty, print the message "List is empty". If the list is not empty, we will make the head to point to next node in the list, i.e., we will delete the first node. ![]() Circular linked list after deleting node from beginning. ![]() Here, A represents the head of the list. We need to delete a node from the beginning of the list. So, we will remove A such that B will become new head and tail will point to the new head. Algorithm
a. display() will show all the nodes present in the list.
Program:Output: Original List: 1 2 3 4 Updated List: 2 3 4 Updated List: 3 4 Updated List: 4 Updated List: List is empty Next TopicJava Programs |
Java Convert String to Object We can convert String to Object in java with assignment operator. Each class is internally a child class of Object class. So you can assign string to Object directly. You can also convert String to Class type object using Class.forName() method. Java String to...
1 min read
The object is a basic building block of an OOPs language. In Java, we cannot execute any program without creating an object. There is various way to create an object in Java that we will discuss in this section, and also learn how to create...
7 min read
An array numArr[] is given, which only contains the non-negative integers, and an integer sp is also provided. The task is to partition the array into sp continuous subarrays such that the largest sum among these sp subarrays is minimum. Note that subarrays can never be...
19 min read
Program to copy all elements of one array into another array In this program, we need to copy all the elements of one array into another. This can be accomplished by looping through the first array and store the elements of the first array into the...
2 min read
ASCII acronym for American Standard Code for Information Interchange. It is a 7-bit character set contains 128 (0 to 127) characters. It represents the numerical value of a character. For example, the ASCII value of A is 65. In this section, we will learn how to print...
3 min read
In this program, we need to remove the duplicate nodes from the given singly linked list. Original List: List after removing duplicate nodes: In the above list, node 2 is repeated thrice, and node 1 is repeated twice. Node current will point to head, and index will point...
7 min read
In this program, we need to sort the given array in ascending order such that elements will be arranged from smallest to largest. This can be achieved through two loops. The outer loop will select an element, and inner loop allows us to compare selected...
4 min read
In this program, we need to check whether the given matrix is an identity matrix. Identity Matrix A matrix is said to be an identity matrix if it is a square matrix in which elements of principle diagonal are ones, and the rest of the elements are...
4 min read
In this program, we need to find out the nodes which are at the maximum distance in the binary tree. According to our approach, all the distances between all the nodes of the tree will be kept in the variable distance. The distance with the...
10 min read
In this section, we will learn how to reverse a number in Java using while loop, for loop and recursion. To reverse a number, follow the steps given below: First, we find the remainder of the given number by using the modulo (%) operator. Multiply the variable reverse...
5 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India