public class testincr
{
public static void main(String args[])
{
int i = 0;
i = i++ + i;
System.out.println("I = " +i);
}
}
a. l = 0
b. I = 1
c. l = 2
d. l = 3
Answer:
b. I = 1
Explanation
The execution goes on like this:
int i = 0; // i is set to 0
i = 1 + i; // i in incremented by 1 so i value is 1
In print statement 1 will be printed.