What will be the output of the following code int m = 2; int n= 15; for(int i = 1; i < 5; i++). m++; - - n; System.out.println("m =" +m) ; System.out.println("n =" +n);
Answers
Answered by
18
Answer:
Output will be
m=6
n=14
Explanation:
In for loop m will iterate 4 time as there postfix operator so it will first print value of m ie, 6 and then it will Increamented by 1.
And for n, as there prefix operator used it will immediately decrement n by 1
Answered by
0
output will be
m=6
n=14
Similar questions