• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

| operator

 
Andrey Opanasets
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following are true. Select all correct answers.

1. && operator is used for short-circuited logical AND.

2. ~ operator is the bit-wise XOR operator.

3. | operator is used to perform bitwise OR and also short-circuited logical OR.

4. The unsigned right shift operator in Java is >>.

My answer is 1 and 3. But tests answer is 1. Can anybody explain why 3 is not correct?
 
Vikrama Sanjeeva
Ranch Hand
Posts: 760
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Test says true.....
| operator is used to perform bitwise OR and also short-circuited logical OR.
The first part of statement is true but second part is not.For short-circuited | | is used.
Bye.
Viki.
------------------
Count the flowers of ur garden,NOT the leafs which falls away!i
[This message has been edited by Vikrama Sanjeeva (edited November 07, 2001).]
 
fengqiao cao
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
because | is not short-circuit operator. in jave only && and | | are short circuit operator.
hopes help
 
Andrey Opanasets
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
| we may used as a logical operator. It confused me.
thanx to all.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic