int i=1;int j;j=i++;(结果i=2,j=1);减法同理
int i=1;int j;j=++i;(结果i=2,j=2);
int i=5;
do {
System.out.println(i);
} while (i-->3);输出5,4,3
int i=5;
do {
System.out.println(i);
} while (--i>3);输出5,4
2.
arithmetic right shift operator,算术右移运算符,>>表示带符号右移,左边补上符号位
logical right shift operator,逻辑右移运算符;>>>无符号右移:无符号,左边补0
3正确表达
float a=2.0f;double a=2.0; double b=2; int c=2; long d=2; long d=2L;
long f=2; float y=2;
long h=2l;
4正确的创造数组
float f[][]=new float[6][6];
float []f[]=new float[6][6];
float [][]f=new float[6][6];后面两个不能为空。
5
int m[]={0,1,2,3,4,5,6};属性
String n="asiaking";方法
System.out.println(m.length+"to"+n.length());7to8
6
boolean m=true;
if (m=false) (m==false也对)
System.out.println("False");
else
System.out.println("true");
结果为true,if到else中间这段不执行。
7
outer:for (int i = 0; i < 3; i++)
inner:for (int j = 0; j < 2; j++) {
if (j==1) continue outer;
System.out.println(j++ +"to"+ ++i);
}结果0to1
0to3;
8
switch(m){
case 0:System.out.println("0");
case 1:System.out.println("1");
case 2:System.out.println("condition2");break;
case 3:System.out.println("condition3");break;
default:System.out.println("other condintion");
}注意break,m=0输出0,1,condition2;
m=1输出,1,condition2;
m=2输出condition2;
9
public class test{
private float f=1.0f;
int m=12;
static int n=1;
public static void main(String args[]) {
test t=new test();
System.out.println(t.f);
// System.out.println(this.n);//错
// System.out.println(test.m);//错
System.out.println(test.n);
}
}
10
public class Example{
Double d1=new Double(1.0);
Double d2=new Double(1.0);
public static void main(String args[]) {
Double d1=new Double(1.0);
Double d2=new Double(1.0);
Float f=new Float(1.0F);
System.out.println(d1==d2);
System.out.println(d1.equals(d2));
System.out.println(f.equals(d1));
}
}
false
true
false
11