Alejandro Daza wrote:I Really dont know why the mask gets 2 increment if there is only one mask++ in the code and I more that sure when you refer a variable to itself it does not increment, so I am really confused I really dont know what it is.
Look at the following atachement.
public class Spock{
public static void main(
String[] args){
int mask = 0;
int count = 0;
if(((5<7) || (++count < 10)) | mask++ < 10) mask =mask; // mask gets incremented after
testing condition so mask = 1
if((6 > 8) ^ false) mask =mask; // condition is always false as false XOR false is TRUE; skips to the next condition
if(!(mask > 1)&& ++count > 1) mask =mask; // Evaluates to false as count is incremented before testing condition so skips to next line
System.out.println(mask + " " + count); // mask = 1 and count count = 1
}
I hope that helps
}