Automorphic Number in Java

Automorphic numbers are those numbers that when squared have the exact same end digits as the number. For example, the number 376. Now the square of the number, 376 is 141376. The last three digits of the square are exactly like the number themselves. Hence, 376 is an Automorphic Number. However, let the number is 45. Now the square of the number, 45 is 2025. The last two digits of the square (25) are not same as the number 45.

Read more

Neon Number in Java

Here in this tutorial you will learn how to check a neon number in Java. What is a Neon Number? Neon numbers are those numbers whose sum of the digits when squared is exactly the same as the number itself. For example, the number 9. Now the square of the number, 9 is 81. The sum of the digits in the square, 81 is 8 + 1 = 9, which is equal to the number itself. Hence, the number 9

Read more

Java Random Number Generator

Random numbers may be required for sorts of programming jobs. For example, statistical sampling, computer simulation, cryptography, and other areas where producing random unpredictable results is desirable. Java provides certain ways in which we can generate random numbers. Although, the generated random numbers are pseudo-random, they get the work done mostly. We can generate random numbers in Java using the following two ways. Java Random Number Generator Method 1: lang.Math To generate random numbers, we can use the Math.random() method.

Read more

How to Square a Number in Java

We can square a number in Java in no less than two different ways. Let have a look on each method one by one. Method1: Multiplying the Number by Itself To square a number x, we can multiply the number by itself. Y = x * x. Java Program for the above method.

Output: Enter a number: 5 The Square of the number is : 25 Method 2: Using the Math.pow() Function Lets have a look how we can

Read more

Magic Number in Java

Magic Number is a number whose sum of the digits when recursively added to the point that a single digit is obtained, comes out to be 1. For example, consider the number 1882. Sum of the digits in the first iteration for 1882: 1 + 8 + 8 + 2 = 19. Sum of the digits in second iteration for 19: 1 + 9 = 10. We have still not obtained a single digit sum. Let’s sum the digits again.

Read more

Infinite Loop in Java

Infinite loop in java refers to a situation where a condition is setup so that your loop continues infinitely without a stop. A loop statement is used to iterate statements or expressions for a definite number of times but sometimes we may need to iterate not for a fixed number but infinitely. For such situations, we need infinite loops in java. There are basically three looping structures in java: for, while and do while. These structures are used for iterations

Read more

Java Reference Variable

We often are stuck at discussion about Objects and their references, it is known fact that unlike C or C++, java doesn’t allows variable access using pointers, well why it does not allows is itself a whole topic which you can read here. Today we will discuss about what all types can be given to java variables or objects. Before moving on to that concept let’s have a look at what do we mean by Reference Variable? Java Reference Variable

Read more

Why is Java So Popular?

In the world of updated and aware world, the world has seen a transition from the computer curve to Mobile Phone or smartphone as it is frequently referred, but what has remain constant in this evolving world is Java. Java was designed keeping syntax similar to C/C++, to make it look familiar to application developers. This forms one of the most important reasons of popularity of Java. But not limiting to this, let’s have a look at the underlying reasons

Read more
1 2 3 4 6