File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Short-Circuit Problem

 
Micheal John
Ranch Hand
Posts: 344
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


 
Sanjeev Singh
Ranch Hand
Posts: 381
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
||(short circuit OR) don't bother to check the second OR if the first one is true while (|) bitwize OR does.
 
annapurna madala
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you said thats the short-circuit problem
In the first case, ++z>5 evaluates to true, so the ++z>6 will not be evaluated(because '||' is a short-circuit operator)
where as in the second case, even when the first operand evaluates to true ++z>6 will be executed giving the output as 8
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic