my dog learned polymorphism
The moose likes Java in General and the fly likes unary operators Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "unary operators" Watch "unary operators" New topic

unary operators

khella smith
Ranch Hand

Joined: May 06, 2002
Posts: 39
do the unary operators operate on single values or double values?
+2 isn't this an unary operator? and as i can see it is operating on a single value
because i know that it includes ++ -- + = etc according to complete java2 certification guide
i took one mock exam which i forgot the name and it said that unary operators operate on a double value
please clarify it for me
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Please change your name to be compliant with JavaRanch's naming policy.
Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Originally posted by kelest:
it said that unary operators operate on a double value
please clarify it for me

Perhaps it meant the *datatype* double (as in +2.45)?

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
I agree. Here's the link:
subject: unary operators
It's not a secret anymore!