A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Java
»
Beginning Java
Author
+- operator
podonga poron
Ranch Hand
Joined: May 12, 2008
Posts: 55
posted
Jun 05, 2008 21:45:00
0
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: 56180
13
I like...
posted
Jun 05, 2008 22:02:00
0
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 ]
[
Smart Questions
] [
JSP FAQ
] [
Books by Bear
] [
Bear's FrontMan
] [
About Bear
]
podonga poron
Ranch Hand
Joined: May 12, 2008
Posts: 55
posted
Jun 05, 2008 22:16:00
0
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
posted
Jun 05, 2008 22:24:00
0
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
posted
Jun 05, 2008 23:14:00
0
Eureka !
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: +- operator
Similar Threads
Primitive Data type Simple Problem
operators
A greenhorn's question concerning method parameters
byte question
q 19 from ~danchisholmguide mughal/chapter2/exam1.html
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter