- 3
R
int k=10; k= k++; System.out.printl(k); Output in Java ??
6 odpowiedzi
+ 1
abhishek bairwa
10 because k++ is post increment which first assign value then increment by 1
So here k++ assigned value 10 to k.
If you don't assign to k then output will be 11
+ 1
Thanku sir
0
Sir output kya hoga
0
Hindi mai batado ek baar sir
0
abhishek bairwa
Output 10 hoga kyonki k++ post increment hai jo pahle value assign karta hai phir 1 se increment karta hai.
Yahan k++ = 10 hoga uske baad k 11 hoga lekin uske pahle k++ ki value k me assign hogi to k 10 ho jayega. Lekin agar k = k++ nahi hota only k++ hota to k ki value 11 hoti.
Example 1:-
k = k++;
System.out.println(k); //10
Example 2:
k++;
System.out.println(k); //11
0
int k=10,j;
j= k++;
System.out.println(j);
System.out.println(k);
Output in Java ??