Possible Duplicate:
& vs && and | vs ||
What is the difference between & and &&?
I am getting same output for both & and &&.
Ex:
&&:if (true && true){ System.out.println("------if------"); } else { System.out.println("------else------"); }&:if (true & true){ System.out.println("------if------"); } else { System.out.println("------else------"); }
Output:
------if------------if------
Can we use & and && operators in our code interchangeably?