Jump to content
Volvospeed Forums

Off Topic: The Thread


Jesus

Recommended Posts

Alright I wrote a process synchronization program for a homework assignment like a week ago in Java. Then I ran it and found it didnt work. I pondered for like the whole week why it didn't work. My roomate finally does the assignment, and his works fine. I look over his code, and it is almost identical. Until I see...... that he used '&&' in an if statement and I used '^'. I changed to && and my code magically worked. Both compile and run fine, but apparently the ^ does not mean AND in Java? WTF?

I doubt most of you get whats up, but any software guys know why?

Link to comment
Share on other sites

Alright I wrote a process synchronization program for a homework assignment like a week ago in Java. Then I ran it and found it didnt work. I pondered for like the whole week why it didn't work. My roomate finally does the assignment, and his works fine. I look over his code, and it is almost identical. Until I see...... that he used '&&' in an if statement and I used '^'. I changed to && and my code magically worked. Both compile and run fine, but apparently the ^ does not mean AND in Java? WTF?

I doubt most of you get whats up, but any software guys know why?

glad i only had to take c++

Link to comment
Share on other sites

Alright I wrote a process synchronization program for a homework assignment like a week ago in Java. Then I ran it and found it didnt work. I pondered for like the whole week why it didn't work. My roomate finally does the assignment, and his works fine. I look over his code, and it is almost identical. Until I see...... that he used '&&' in an if statement and I used '^'. I changed to && and my code magically worked. Both compile and run fine, but apparently the ^ does not mean AND in Java? WTF?

I doubt most of you get whats up, but any software guys know why?

As you know I don't have any experience in Java. I haven't seen anyone use a '^' in C yet but I did a little research and heres what I came up with some truth tables. Check it out.

// create truth table for && (conditional AND) operator

System.out.printf( "%s\n%s: %b\n%s: %b\n%s: %b\n%s: %b\n\n",

"Conditional AND (&&)", "false && false", ( false && false ),

"false && true", ( false && true ),

"true && false", ( true && false ),

"true && true", ( true && true ) );

// create truth table for ^ (boolean logical exclusive OR) operator

System.out.printf( "%s\n%s: %b\n%s: %b\n%s: %b\n%s: %b\n\n",

"Boolean logical exclusive OR (^)",

"false ^ false", ( false ^ false ),

"false ^ true", ( false ^ true ),

"true ^ false", ( true ^ false ),

"true ^ true", ( true ^ true ) );

Conditional AND (&&)

false && false: false

false && true: false

true && false: false

true && true: true

Boolean logical exclusive OR (^)

false ^ false: false

false ^ true: true

true ^ false: true

true ^ true: false

http://www.java2s.com/Tutorial/Java/0060__...orsinaction.htm

So, ^ is an OR operand and && is an AND operand.

Link to comment
Share on other sites

Dave, Remember when you posted you accidently broke a guys nose at work? I think you left out some details

Today, I was running down the hallway when a door opens and hits me right on the face. I'm sitting there with my nose bleeding and a huge bump forming on my head. The guy who comes out is hugely fat, tries to help me up, trips, and falls on me. I accidentally groped his moobs while trying to push him off. FML

http://www.fmylife.com/miscellaneous/964759

Link to comment
Share on other sites

What the fuck :angry:

Everything I have ever done and ever seen, '^' means AND. And in Java, if I remember right, the '|' means OR.

I don't think they are going to change it for you, better embrace it :D

Been doing PHP and its always used && switched over to Java for my new job so no issues there.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...