^=

R

RVic

What does the operator:

^=

do?

I have it used in code I am working with as:

byte u = 0x00;
for(int i = 0; i < msg.length(); i++) {
// ASSUMES: ASCII
u ^= (byte)msg.charAt(i);
}
u ^= 0x03;

//thx
 
L

Lars Enderin

RVic said:
What does the operator:

^=

do?

I have it used in code I am working with as:

byte u = 0x00;
for(int i = 0; i < msg.length(); i++) {
// ASSUMES: ASCII
u ^= (byte)msg.charAt(i);
}
u ^= 0x03;

In general, x <OP>= y works like x = x <OP> y. Find out what the
operator ^ does, and go figure.
 
T

Tom Anderson

In general, x <OP>= y works like x = x <OP> y. Find out what the operator ^
does, and go figure.

Great, now i know what == does!

Bit confused about != though.

:)

tom
 
L

Lars Enderin

Tom said:
Great, now i know what == does!

Bit confused about != though.
Cute. Note that I wrote "in general". Perhaps I should have written
"generally" or "usually". Anyway, the "=" is the assignment operator
, of course. I
started out with FORTRAN, and graduated to Simula, which uses ":=", and
then I started programming in C, etc...
 
T

Tom Anderson

Cute. Note that I wrote "in general".

Insufficient to prevent jokes!
Perhaps I should have written
"generally" or "usually". Anyway, the "=" is the assignment operator
, of course. I started out with FORTRAN, and graduated to Simula, which uses
":=", and then I started programming in C, etc...

Ah, := in java would be the second part of the ternary assignment operator ...

tom
 
R

Roedy Green

Bit confused about != though.

I would have preferred <>

I used it, unthinkingly the other day, and puzzled that javac did not
like it. A Pascal flashback.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top