//腾讯面试题
int i =1;
int result=i+++3<<2;//16
System.out.println(result);
int j = 2;
System.out.println(j++);
int result2 =(j++ >2)?(++j):(j+=5);
System.out.println(j++ >2);
System.out.println(result2);//6,j参与运算,赋值后再加
System.out.println("sdfdf\r");
//以下程序的运行结果:
boolean x= true;
boolean yy=false;
short zz=20;
if((x==true) && (yy=true)) zz++;
if((yy==true) || (++zz==22)) zz++;//双||,前面为true,右面不参与
System.out.println("z="+zz);//22
//求程序运行结果
int[]xxx={1,2,3};
xxx[1]= (xxx[1]>1)?xxx[2]:0;
System.out.println(xxx[1]);//3
//1 instanceof integer
int iii =23;
//System.out.println(iiiinstanceof Integer);
Integer i1 = -128;
Integer h = -128;//在-128,127之间是相等的
System.out.println(i1==h);//true
|
|