Once you click post assignment, learners in the selected class will immediately be able to see and complete this assignment

Back to Classroom

Scientific Notation

Introduction To Java Course

Engineers From These Top Companies and Universities Trust EXLskills

1M+ Professionals | 100+ Institutions

This is the EXLskills free and open-source Introduction To Java Course. It guides learners via explanation, demonstration, and thorough practice, from no more than a basic understanding of Java, to a moderate level of essential coding proficiency.

Is this course FREE?

Yes, this a 100% free course that you can contribute to on GitHub here!

When working with large numbers, scientific notation is exceptionally helpful. In scientific notation, the letter 'e' represents "10 to the power of". For example, "1.51E+1" means the same thing as "1.51x10^1". Let's review some examples of scientific notation below.

ScientificNotationExample.java

package exlcode;
public class ScientificNotationExample {
public static double exampleVariableOne = 1E+3;
public static double exampleVariableTwo = 1E+12;
public static double exampleVariableThree = 1E-4;
public static void main(String[] args) {
System.out.println(exampleVariableOne);
System.out.println(exampleVariableTwo);
System.out.println(exampleVariableThree);
}
}

In the section on the long datatype, we discussed the difficulty of writing very large numbers. Scientific notation solves that problem. It can also be used to represent small numbers with many decimal places. The format of scientific notation in Java is exactly the same as you have learned and used in science and math classes. Remember that an uppercase 'E' or lowercase 'e' can be used to represent "10 to the power of". Scientific notation can be printed as output on the console if it passes a certain number. Using System.out.println(exampleVariableOne); as an example, smaller numbers will still read out "1000" instead of "1E+3".