[OT] help w/ bitwise comparison operators

Erik Price eprice at ptc.com
Fri Mar 21 14:48:09 EST 2003


Kevin D. Clark wrote:

> OK, now we're really splitting hairs, and I suspect that you mistyped
> anyways, but just to be clear, the logical operators work on any
> scalar type.
> 
> For example, these are all legal in C:
> 
>         1 && 2
>         2 && 3.14
>         2.718 && "hello"
>         'b' && &foo;

Oh sorry, I wrote in one of those posts that this is all WRT the Java 
virtual machine.

<class name="ShortCircuit.java">
public class ShortCircuit {
     public static void main(String[] args) {
         System.out.println(1 && 2);
     }
}
</class>

<shell>
$ javac ShortCircuit.java
ShortCircuit.java:3: operator && cannot be applied to int,int
         System.out.println(1 && 2);
                              ^
1 error
</shell>



Erik




More information about the gnhlug-discuss mailing list