• Post Reply Bookmark Topic Watch Topic
  • New Topic

order of operators  RSS feed

 
noha saltan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will the expression
! ( j * I = = x + y && I > 0)
Compile without error? List the operators in this expression in precedence order, from highest to lowest. List the operators in the order in which they will be evaluated.


can you help me to check my solution

the exception will rise because there is no variable to assign , the order from high to low is

!
*
+
>
==
&&

the order when evaluate is

*
+
==
>
&&
!

Please help me my solution is right ???
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, the question doesn't ask about exceptions, which happen when a program runs; it asks whether the code will compile or not (of course, you can trivially check this yourself: it won't, as written, but if you remove the space between the two equals signs, it does.)

As far as "there is no variable to assign", I don't know what you mean by that, but it doesn't enter into the answer.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!