Displaying maximum values of various integer types

Report a typo

Imagine a Java program that prints the maximum values of different types of integer data that store binary information. It displays the maximum value for byte, short, int, and long. Your task is to fill in the blanks in the code so it works correctly, considering the maximum storage capacity for each data type.

Fill in the gaps with the relevant elements
public class Main {
    public static void main(String[] args) {
         b = 127;
         s = 32767;
         i = 2147483647;
         l = 9223372036854775807L;
        System.out.println("Max value for byte: " + b);
        System.out.println("Max value for short: " + s);
        System.out.println("Max value for int: " + i);
        System.out.println("Max value for long: " + l);
    }
}
shortintbytelong

Create a free account to access the full topic