How to reverse a string in Java

This tutorial will guide you to understand how to reverse a string in Java using different methods. A string is a group of characters that terminates with ‘\0’. Hence reversing a string means displaying the sequence of characters in the reverse order. For example, if a string is “Welcome”, the …

Read more

How to find the smallest number in an array Java

In this tutorial, we will see the different approaches on how to find the smallest number in an array in Java. Sort and swap technique In this method, we actually compare the 1st element with the 2nd element and sort the elements in ascending order using a third variable. In …

Read more

How to limit decimal places in Java

In this tutorial, we will understand how to limit decimal places in Java based on the requirement. There are different methods to round a number to n decimal places in Java. For this, the input string is generally a float or a double value, which consists of several digits after …

Read more

Convert char array to String in Java

In this tutorial, we will understand the different ways to convert a char or character array to String in Java. A character array contains a group of characters while a string also contains a set of characters that terminates with ‘\0’ Methods to Convert char array to String in Java …

Read more

Convert char to string in Java

In this tutorial, we will discuss various methods on how to convert char to String in Java. As we know, a char data type stores a single character whereas a String stores an array of characters. Char to String conversion methods in Java Convert char to String in Java using …

Read more

Convert a char to int Java

This tutorial will guide you through different methods to convert a char to an int in Java using various examples. A char is a data type to store a single character and an int is a data type to store a numeric value. Different methods for char to int conversion …

Read more

Convert int to String in Java

In this tutorial, we will learn and understand the different ways to convert int to String in Java. We will also demonstrate Java Integer to String conversion with detailed examples. Different methods of Integer to String conversion Convert int to String using String.valueOf() The String class contains a static method …

Read more

How to return an array in Java

In previous articles, we have seen how we can return a value from a method in Java. There are situations where we need to return multiple values or an array from a function. This tutorial will guide you on how to return an array in Java of various data types. …

Read more

ReadWriteLock in Java

This tutorial covers about ReadWriteLock in Java, its methods, and how to implement it using a detailed example. Java ReadWriteLock ReadWriteLock is an interface in Java that is part of the java.util.concurrent.locks package. It is an advanced lock mechanism that allows multiple threads to read a shared resource but only …

Read more

Translate ยป