java

java

Java Stream findAny method explanation with example

findAny method is used to get an element from a Java Stream. For an empty stream, it returns one empty optional value. For null element, it throws one NullPointerException.

Read
java

Java stream findFirst() explanation with example

findFirst of Stream API is used to find the first element in a stream in Java. It returns one Optional value that holds the element if found. For empty stream, one empty optional is returned.

Read
java

Two different ways to start a thread in Java

Learn how to start a thread in Java in two different ways. We will learn how to start a thread by extending the Thread class and by implementing the Runnable interface.

Read
java

Java program to find the third largest number in an unsorted array

Java program to find the third largest number in an unsorted array. Our program will pass one unsorted array to a function, it will find the third largest number and return it.

Read
java

What is a copy constructor in Java - Explanation with example

Learn about copy constructor in Java. Copy constructor works in a similar way to other constructors. The only difference is that it takes one object of the same class and then assign values to the variables of the class.

Read
java

Java program to calculate electricity bill

In this tutorial, we will learn how to find the electricity bill using Java. I will show you different ways to solve this problem. Actually, the algorithm to solve that problem is the same but different ways to write the code.

Read
java

Java Math decrementExact explanation with example

Java decrementExact is a utility method defined in java.lang.Math class. We can pass one argument and it returns the argument decremented by one. This method is available for integer and long argument types.

Read
java

Java Math incrementExact explanation with example

incrementExact is used to increment the value of an integer or double. This method is defined for both integer and doubles. Following are the definitions of this method :.

Read
java

How to use addExact and subtractExact in Java 8

In this tutorial, we will learn two new methods added in Java 8 - addExact and subtractExact. These methods are used for addition and subtraction. I will show you how to use these methods with examples.

Read
java

Java program to subtract one matrix from another

In this Java programming tutorial, we will learn how to subtract one matrix from another matrix. The program will ask the user to enter values for both of the matrices and it will calculate the subtraction result. Finally, the program will print out the result matrix.

Read