Declaring variables for different numeric values

Report a typo

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.

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);
    }
}
byteshortintlong
___

Create a free account to access the full topic