Given the code fragment:
int a = 0;
a++;
System.out.println(a++);
System.out.println(a);
What is the result?
A.
1
2
B.
0
1
C.
1
1
D.
2
2
Explanation:
The first println prints variable a with value 1 and then increases the variable to 2.
Given the code fragment:
int a = 0;
a++;
System.out.println(a++);
System.out.println(a);
What is the result?
Given the code fragment:
int a = 0;
a++;
System.out.println(a++);
System.out.println(a);
What is the result?
A.
1
2
B.
0
1
C.
1
1
D.
2
2
Explanation:
The first println prints variable a with value 1 and then increases the variable to 2.