- 3

R

int k=10; k= k++; System.out.printl(k); Output in Java ??

29th Apr 2021, 12:16 PM
Abhishek
Abhishek - avatar
6 Antworten
+ 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
29th Apr 2021, 12:43 PM
A͢J
A͢J - avatar
+ 1
Thanku sir
29th Apr 2021, 2:37 PM
Abhishek
Abhishek - avatar
0
Sir output kya hoga
29th Apr 2021, 12:50 PM
Abhishek
Abhishek - avatar
0
Hindi mai batado ek baar sir
29th Apr 2021, 12:50 PM
Abhishek
Abhishek - avatar
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
29th Apr 2021, 2:13 PM
A͢J
A͢J - avatar
0
int k=10,j; j= k++; System.out.println(j); System.out.println(k); Output in Java ??
30th Apr 2021, 5:18 AM
Abhishek
Abhishek - avatar