Home » JAVA Programming » Basic Datatypes » Question
  1. What is the output of this program?
    public class increment {
    public static void main(String args[]) {
    int a = 5;
    System.out.print(++a * 6);
    }
    }
    1. 36
    2. 25
    3. 30
    4. 40
    5. 12
Correct Option: A

Operator ++ has more preference than *, thus a becomes 6 and when multiplied by 6 gives 36.
output: 36



Your comments will be displayed only after manual approval.