java logo

Program to find the average of numbers using array p

public class JavaExample { public static void main(String[] args) { double[] arr = {19, 12.89, 16.5, 200, 13.7}; double total = 0; for(int i=0; i<arr.length; i++){ total = total + arr[i]; } /*…

Read more
java logo

Java Programs

  import java.util.Scanner; class Main { public static void main(String[] args) { char operator; Double number1, number2, result; // create an object of Scanner class Scanner input = new Scanner(System.in); // ask users…

Read more
java logo

C++ vs Java

There are many differences and similarities between the C++ programming language and Java. A list of top differences between C++ and Java are given below: Comparison Index C++ Java Platform-independent C++ is platform-dependent. Java is platform-independent….

Read more
java logo

Java program to delete a new node from the middle of the doubly linked list

In this program, we will create a doubly linked list and delete a node from the middle of the list. If the list is empty, display the message “List is empty”. If the…

Read more
java logo

Java program to find the maximum and minimum value node from a doubly linked list

In this program, we will create a doubly linked list then, iterate through the list to find out the minimum and maximum node. We will maintain two variables min and max. Min will…

Read more
java logo

java program to search an element in a singly linked list

Java Program to search an element in a singly linked list In this program, we need to search a node in the given singly linked list. Identity Matrix To solve this problem, we…

Read more
java logo

Peterson Number in Java

In this section, we will learn what is Peterson number and how can we check whether a given number is Peterson or not through a Java program. Peterson Number A number is said to be Peterson if the…

Read more
java logo

Java program to find the maximum and minimum value node from a linked list

In this program, we need to find out the minimum and maximum value node in the given singly linked list. We will maintain two variables min and max. Min will hold minimum value…

Read more
java logo

Java program to determine whether a singly linked list is the palindrome

In this program, we need to check whether given singly linked list is a palindrome or not. A palindromic list is the one which is equivalent to the reverse of itself. The list…

Read more
java logo

Singly linked list Examples in Java

Linked List can be defined as a collection of objects called nodes that are randomly stored in the memory. A node contains two fields, i.e. data stored at that particular address and the…

Read more