This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
Hi Bit of a Programming 101 question but what does the unary operator () do? The following list might also be helpful for people studying for the test Thanx, Paul Unary operators are: ++ -- + - ! ~ () Arithmetic operators are: * / % + - Shift operators are: << >> >>> Comparison operators are: < <= > >= instanceof == != Bitwise operators are: & ^ | Short-circuit operators are: && || Conditional operators are: ?: Assignment operators are: = "op="
I don't know if () is considered an operator, but if it is, I would say it returns unchanged value of what's inside it. Consider this: 7++ evaluates to 8 5+6 evaluates to 11 Cat instanceof Animal evaluates to true b = 5 evaluates to 5 (can be checked by a = b = 5, a will be 5 as well) so since all those expressions evaluate to something (an we consider parantheses an operator) whatever is inside the () will evaluate to itself: (5) returns 5 [ March 04, 2004: Message edited by: Yuriy Grechukhin ]
The sword of destiny has two blades, one of them is you.
hi, you have postfix() like in a method/constructor: aMethod() Aconstructor() and you can have cast: (type)e post fix is higher in precedence than the unary operators, and cast is lower than unary. is this what you meant? Davy