How to declare and initialize an array in Java

That's probably one of the most popular topics about programming and software engineering. Arrays are used in many software applications. That is the core functionality of almost any programming language. As a result, it's very important for any developer to know how to correctly work with the arrays. Java language allows you to declare and …

How to split a string in Java

Splitting a string is a very simple task in Java language. There is already built-in functionality that allows you to quickly get the desired results. The String.split() method should fulfill most of the needs. This tutorial will show you various options that can be added to the code. In addition, at the end of the …

How to read a file to string in Java

You may want to read this tutorial to learn how to process files in Java. Very often, the data may be stored on disk in various formats. And to use that data in application, you have to write a special code that can read the content of a file into memory. The Java language is …

How to sort arrays in Java

If you need to sort some array of data in Java programming language, then this tutorial may be useful. There are various options available that can help you to get the desired result. For example, you can use the standard sort() method. Also, you can implement your own custom sorting function. Each option has advantages …

How to generate a random number in Java

If you need to generate a random number in the Java programming language, then this article may help you. Please review the following sections to learn how to use the standard Java API to get a random integer, float or double value. Also, there are methods that allow you to generate arrays with random values. …

How to compare two strings in Java

This tutorial may be helpful if you need to compare two strings in the Java programming language. This is a very simple task. You just have to use a special method that will check if the string values are equal. However, the Java language provides many different methods that can be used for that purpose. …

How to change user in Linux terminal

Linux is a multi-user operating system. It allows the user to perform various operations with system resources. For example, you can manage groups, add or remove users, modify file permissions and so on. As a result, there may be a situation when you need to change the current user. You may want to run a …