集册 Java实例教程 使用一元加号和减号运算符

使用一元加号和减号运算符

欢马劈雪     最近更新时间:2020-01-02 10:19:05

563
使用一元加号和减号运算符
/**
 from
* n  o  w  j  a  v  a . c o m 
**/

int a = 5;     // a is 5

int b = -a;    // b is -5

int c = -b;    // c is +5


int a = -5;    // a is -5

int b = +a;    // b is -5

a = 5;         // a is now 5

int c = +a;    // c is 5