In a Java program, you're required to store four different numbers: 127, 32767, 2147483647, 9223372036854775807L respectively. Each number exceeds the highest value of the previous by a considerable amount. To print them out using System.out.println, fill the blanks in the code to declare variables for each number with the most efficient data type.
Primitive data types and their sizes
Declaring variables for different numeric values
Report a typo
Fill in the gaps with the relevant elements
public class Main {
public static void main(String[] args) {
smallByte = 127;
smallShort = 32767;
smallInt = 2147483647;
largeLong = 9223372036854775807L;
System.out.println("Byte: " + smallByte + ", Short: " + smallShort + ", Int: " + smallInt + ", Long: " + largeLong);
}
} ___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.