日期:2014-05-20 浏览次数:20823 次
public class Demo3_5 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a = 9;
int b = -a;
byte bb = 9;
int ib = +bb;
int x = 4, y = 8;
int z;
int i = 0;
int j= i++;
int k=++j;
z = (x++)*(y--);
System.out.println("a ="+a);
System.out.println("b ="+b);
System.out.println("bb ="+bb);
System.out.println("ib ="+ib);
System.out.println("i ="+i);
System.out.println("j ="+j);
System.out.println("k ="+k);
System.out.println("x ="+x);
System.out.println("y ="+y);
System.out.println("z ="+z);
}
}
int j= i++; //这里的i是先赋值,后++ ,因此赋值给“j”的事“0”哦,
int k=++j; //这里先++后赋值,因此这里“k”是“1” 望楼主切记哦……
public class Demo3_5
{
public static void main(String[] args)
{ // TODO Auto-generated method stub
int a = 9;
int b = -a;
byte bb = 9;
int ib = +bb;
int x = 4, y = 8;
int z;
int i = 0;
int j= i++; //j=0,i=1
int k=++j; //k=1,j=1;
z = (x++)*(y--); //z=4*8=32; x=5,y=7;
System.out.println("a ="+a);
System.out.println("b ="+b);
System.out.println("bb ="+bb);
System.out.println("ib ="+ib);
System.out.println("i ="+i);
System.out.println("j ="+j);
System.out.println("k ="+k);
System.out.println("x ="+x);
System.out.println("y ="+y);
System.out.println("z ="+z);
}
}
????????int?i?=?0;
????????int?j=?i++;//j=0,i=1
????????int?k=++j;//k=1,j=1