while loop random number Java

So in this post we try to do a simple loop that display some random Numbers. See example below:

Armstrong number in Java using for loop

It is a very good exercise to improve our logic and we wish to solve some problems. And so in this post we try to give example on how to solve this problem, determining Armstrong number in Java using for loop.

Java print even numbers while loop

We try to solve specific logical problems in Java using some form of loops. In this post we present an example on how to print even numbers using while loop in Java

Java Random Int

Generating random numbers is typically important in some applications that we do. For example, if we are writing a program that needs to shuffle a deck of cards, we can achieve that by swapping cards from random positions. In fact, many games requires random number generation because that makes each play unique from the previous one. Because if there is no randomness, then every time we play will feel the same. So below we try to show examples on how to generate Java Random Int values.

Java Char To String

A Java character is a primitive data type where it can only hold just 1 character value, whereas a String can contain multiple characters. A String represents a sequence of characters, while a char only contains a single character. For example, we can only assign the value 'A' to a char, and if we want to add more characters, we then need a String to do that. For example "AB" can't be stored using a char, but a String can. But sometimes, coming from a character, we wish to convert it into a String with only one char item inside. Below we explore some methods and examples on how to convert a Char To String in Java programming language.

Java Read File To String

File manipulation is a common programming theme that we need to do. As we store some data into a file, it is natural for us to be able to read and write into a file. The most common file format that we encounter is just a plain text file. Which means it would be natural also to read it's contents and put the value into a String variable. In this post, we present several solution on how to Read File To String in Java. We give several solutions, specially with the recent advancement in Java.

Simple Loop - Display All Numbers From 1 To 100

Below is a very simple example that shows how to use simple loop. We will display all numbers from 1 to 100 in Java.

Multiply Assign Operator

The multiply assign operator does two operations in one statement. First is that it multiplies the value of a variable on the left side with the evaluated value of the expression on the right side. The result is assigned back to the variable. This is why it is called a compounded assign operator is because it is a short hand for two operations. Below are examples on Multiply Assign Operator in Java.

Binary Inclusive OR Assign Operator

We share below some examples on how to use Binary Inclusive OR Assign Operator in the Java programming language:

Binary Exclusive OR Assign Operator

XOR or the Binary Exclusive OR operation is a common bitwise operation in any language, including Java. Below are examples on how to use Binary Exclusive OR Assign Operator in the Java programming language: