I am new to Java and have background of C.I am going through Khalid Moughal's book.
On page 126 he gives an example as
int i = 10;
int k = ++i + --i; // ((++i) + (--i)).
This clearly violates the sequence point concept as of C,which says that you can't change the value of a variable more than once with in same sequence point.
My question is does the same sequence point rule applies in java or not?
It may be that he has taken this example just to explain the concept of prefix unary operator and it's side effect but such an example which clearly violates a very fundamental rule of the language is not expected in a book as renowned as Khalid Moughal.
So please confirm it.
Hope you people take it into proper spirit.
Thanks,
Mawia
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…