Easy Tutorial
For Competitive Exams

What is the output of this program?
class increment {
public static void main(String args[])
{
int g = 3;
System.out.print(++g * 8);
}
}

25
24
32
33
Explanation:

Operator ++ has more preference than *, thus g becomes 4 and when multiplied by 8 gives 32.
output:
$ javac increment.java
$ java increment
32
Share with Friends
Privacy Copyright Contact Us