For the logical operators, the operands must be of the type boolean
Suppose the following code:-
int p,q;
p=1;
q=1;
System.out.println("The result is : "+(p&q));
output
The result is : 1
My question is that in the above code, neither of the two variables is of the type Boolean. Then why this code is not producing error?
Also
System.out.println(" This is an error : "+(!p));
Why this statement is producing an error?