Define the types

Report a typo

Define appropriate data types for the variables and expressions in the given Java program. The program includes various numeric variables (int, byte, double, float, and long) and expressions. Fill in the gaps with the correct data types to ensure the program compiles successfully.

Fill in the gaps with the relevant elements
public class Main {
    public static void main(String[] args) {
        int a = 215;
        byte b = 0x5F;
        double c = 20.36;
        float d = 12.02f;
        long e = 2 ^ 32;

         res1 = a + b + 5;
         res2 = c - e + d - a;
         res3 = a + b + d + e;
         res4 = e - 2 * a + b;

         resSum = res1 + res2 + res3 + res4;
        System.out.println(resSum);
    }
}
doublefloatdoubleintlong

Create a free account to access the full topic