while doing practice java tests i came across this piece of code
public class test {
public static void main(String args[]) {
int x,y;
x = 3 & 5;
y = 3 | 5;
System.out.println(x + " " + y);
where x = 1 and y = 7.
i understand that the & operator will evaluate both sides of an if statement as opposed to && evaluating left side first and then the right. (and the same thing for | and ||).
i dont understand how these operators are used in assignment like this. i know it has something to do with binary (i know what binary is) but how can bitwise AND and OR be used in assignments like this to produce these results?