aspose file tools*
The moose likes Beginning Java and the fly likes +- operator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "+- operator" Watch "+- operator" New topic
Author

+- operator

podonga poron
Ranch Hand

Joined: May 12, 2008
Posts: 55
what exatly do the +- operator

example ..

int a = 5;
int b = 2;
int c = a+-b+-b;

c = 1

???
[ June 05, 2008: Message edited by: podonga poron ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Originally posted by podonga poron:
what exatly do the +- operator
+- isn't a single operator. It's the binary plus followed by the unary negation operator.

C= 0 ?? WHY ??
There is no C in your example. Java is case sensitive. If you meant c, then its value is 1.
[ June 05, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
podonga poron
Ranch Hand

Joined: May 12, 2008
Posts: 55
thanks Bear Bibeault !

but i didn't understand, i guest i will have to read more about it .. anyway thanks again !
podonga poron
Ranch Hand

Joined: May 12, 2008
Posts: 55
now i understand it

int a = 5;
int b = 2;
int c = a+-b;

c = 3;

because

5+-2
5+(-2)
5-2
3

i leave this resolved for someone that have the same doubt ...
Vikas Kapoor
Ranch Hand

Joined: Aug 16, 2007
Posts: 1374
Eureka !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: +- operator