java

java

Java program to convert a string to an array of string

In this Java programming tutorial, we will learn how to convert a string to an array of strings. For example, if our input is Hello World, the output will be an array containing both of these words. We will show you two different and most popular ways to solve it.

Read
java

Java strictfp keyword : Explanation with example

strictfp keyword is used for getting the same result of floating point calculation on different platforms. We cannot use strictfp with a class constructor or with methods defined inside an interface. But we can define an interface as strictfp and then all the methods defined inside that interface will become strictfp automatically. Similarly, we can use strictfp for class and methods also.

Read
java

4 ways in Java to sort a String alphabetically

This post will show you how to sort a String in Java in 4 different ways. It will use loops, by converting the String to an Array, by using a comparator and by using Stream.

Read
java

Java deep copy example using SerializationUtils

In Java, copy an object is not an easy task as it looks like. Most of us makes this mistake during the initial days of our development carreer. In Java, objects are not passed by value. For example, let's take a look at the program below :.

Read
java

Java RandomAccessFile explanation with examples

RandomAccessFile is an important class in the Java IO package. Using this class, we can easily point to any position of a file, read any specific part of a file or write content to anywhere within a file. It behaves like a large array of bytes. The cursor, that is used to point to the current position of a file is called file pointer.

Read
java

Java program to do left rotation 'n' times to an array

In this tutorial, we will learn how to do the left rotation to an array. We will take the input from the user. The user will input both elements of the array and also the rotation number. Before starting the code, let me show you what is a left rotation and how it looks.

Read
java

Java example to filter files in a directory using FilenameFilter

Sometimes we need to filter out file list based on its extension. For example, filtering out all .mp3 files in a specific folder. To implement such scenarios in Java, we have one inbuilt interface known as FilenameFilter. In this tutorial, we will learn how to use FilenameFilter to filter out files in a specific directory.

Read
java

4 different Java programs to Convert a double to string without exponential

Learn to convert a double value to string in Java. We will use four different ways to do the conversion. Using String.valueOf(), String.format(), Double.toString(), by adding an empty string and by using DecimalFormat.

Read
java

Java Program to convert an ArrayList to an Array

ArrayList is more flexible than the array. But sometimes we need to convert an ArrayList to an array and this tutorial will show you different ways to convert ArrayList to an array in Java. We have different ways to do this conversion. Let's take a look :.

Read
java

Different usage of super keyword in Java

super keyword is used to refer the parent class object. In this tutorial we will learn main three different usages of super :.

Read