Here the code.
public class Test {
public static void main(String[] args) {
int x=2; int y = 3;
if((y == x++) | (x < ++y)){
System.out.println("x = " + x + "Y = " + y);
}
}
}
This outputs x=3 y=4
Another Criteria
public class Test {
public static void main(String[] args) {
System.out.println(4|3);
}
}
This outputs 7
Here the second criteria |
works as bit wise operator. But in first criteria |
is not. It manipulates and giving the output. I need explanation how the first criteria works.
The thing i know is, |
will compare both sides and ||
will compare only left side and it true it proceeds to next.
Hope my question is clear. Thankyou in advance..