Expressions

Report a typo

Here is the Java code featuring two integers, a and b. This program performs operations with these variables and outputs the result. Near each expression, the author left some comments but forgot to fill them in. Determine what each expression should print and fill in the gaps.

Fill in the gaps with the relevant elements
public class Expressions {
    public static void main(String[] args) {
        int a = 5, b = 11;
        System.out.println(b + a); // Prints 
        System.out.println(b - a); // Prints 
        System.out.println(b * a); // Prints 
        System.out.println(b / a); // Prints 
        System.out.println(b % a); // Prints 
        System.out.println((a - b) + a * (b - a) - a % b); // Prints 
    }
}

Create a free account to access the full topic