Temperature Conversions using Java

In this article, we’ll see the temperature conversions between four different temperature scales named Fahrenheit, Celsius, Kelvin, and Rankine. Temperature Scales Fahrenheit Scale Fahrenheit scale was created by German scientist Daniel Gabriel Fahrenheit According to this scale, water freezes at 32 degrees of Fahrenheit and boils at 212 degrees of Fahrenheit So it will take … Read more

Average of n Numbers in Java

In this post, we’ll see various ways of calculating average of n numbers in Java.1) Average of 3 input numbers2) Average of n numbers input by user3) Average of the numbers in an array Average of 3 input numbers: We are calling nextLine to read the newline character entered after the number. If we do … Read more

Addition of Two Numbers in Java

We will solve this basic problem of the addition of two numbers in three ways, first by using a Scanner, second by using BufferedReader, and at last by using command-line arguments. Addition of two numbers using Scanner Java provides Scanner class in java.util package. This class is very popular to read values from the user … Read more

How to Convert an Integer to Octal in Java

Java wrapper class Integer provides an utility function toOctalString(int) which returns an integer in octal form. However, in this post, we will also see an example on how we can convert integer to octal form mathematically without using Java API classes. If you divide a number with 8, what you get in the reminder is … Read more