java - What is the purpose of adding a positive variable? -


this question has answer here:

i in java1 semester, , asked teacher question, not answer, because didn't know why. or rather couldn't think of purpose serve.

let that, when setting variables a=5 , b=-4. , wanted know value of a+b set system.out.println.

i a + b, a + + b, means add positive b. although b negative positive variable still negative 4.

however, if change equation a - - b, should come out b being positive 4.

so question, purpose of creating equation positive variable if positive variable, variable.

since opposite valid (adding negative such + - b) sign plus doesnt affects value.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -