java

java

Java DayOfWeek explanation with example

DayOfWeek is an enum in Java that represents all seven days of a week. It is defined as :.

Read
java

Java program to check if a matrix is upper triangular matrix or not

In this tutorial, we will learn how to find if a matrix is upper triangular or not. A matrix is called upper triangular if all the elements of the matrix below the main diagonal is 0. Else, it is not an upper triangular matrix.

Read
java

Java program to move all zeroes of an integer array to the end of the array

In this tutorial, we will learn how to move all 0 of an integer array to the end of that array in Java. For example, for the array {1,0,2,0,3,0}, it will become {1,2,3,0,0,0}. The algorithm we are going to use is as below :. array

Read
java

Java program to move all zeroes of an integer array to the start

Two ways in Java to move all the zeros of an integer array to the start of the array. We will learn how to move the zeros by maintaining the order of the numbers and without maintaining the order of the numbers of the array.

Read
java

Static import in Java explanation with example

Using static import in Java, we can access any public static member of a class directly without using its class name. For example, to find the square root of a number , we have sqrt() method defined in Math class. Since it is a public static class (public static double sqrt(double a)), we can call it directly using the class name like Math.sqrt(4). But , we can also use static import of the class Math and call sqrt method directly like sqrt(4).

Read
java

Java program to check if all digits of a number are in increasing order

3 different ways in Java to check if the digits of a number are in increasing order or ascending order. We will learn how to use a while loop, a different method and by converting the number to a String.

Read
java

Java program to check if a number is Pronic or Heteromecic

A number is called a Pronic number or Heteromecic number if it is equal to the product of two consecutive numbers. For example, 9 * 10 = 90, so 90 is a Pronic number.Our program will take the input from the user and check if it is Pronic.Let's take a look at the program first :.

Read
java

Java Program to create a temporary file in different locations

In this tutorial, we will learn how to create a temporary file in Java. We can create a temp file either in the default temporary file location folder or in a specific folder. To handle this, we have two different static methods in the File class. Let's take a look into them first :.

Read
java

Java program to extract all numbers from a string

In this tutorial, we will learn how to extract numbers from a String using Java programming language. The user will enter the string and our program will extract all numbers from the string and print out the result. Let's take a look at the program first :.

Read
java

Java program to print the boundary elements of a matrix

In this tutorial, we will learn how to print the boundary elements of a matrix using Java. For example, for the below matrix :.

Read