Given the code fragment:
int a = 0;
a++;
System.out.println(a++);
System.out.println(a);
What is the result?
A.
12
B.
01
C.
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:
<code>
int a = 0;
a++;
System.out.println(a++);
System.out.println(a);
</code>
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.
12
B.
01
C.
1
D.
2
2
Explanation:
The first println prints variable a with value 1 and then increases the variable to 2.
Shouldn’t the answer be “1 2” ?
Do you mean with spaces between koshzerg?
Actually it should be `print` rather than `println`.
1
2 is what would be printed. Since ln is there a new line would be used.