Menu
Question Index
...

What will be the values of var_a, var_b, var_c? After execution of the program.

public class ValuesAre {
    public static void main(String args[]) {
        int var_a = 20, var_b = 20, var_c = 20;
        var_c += var_a++;
        var_c -= --var_b;
        System.out.print("var_a=");
        System.out.println(+var_a);
        System.out.print("var_b=");
        System.out.println(+var_b);
        System.out.print("var_c=");
        System.out.println(+var_c);
    }
}


21, 19, 21
21, 19, 22
var_a=21
var_b=19
var_c=21
var_a=21
var_b=19
var_c=22
Some other values
Compilation Error or Runtime Error

Doubts

Problems

Topic: Arithmetic Compound Assignment Operators In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App