1 关于Integer int
Integer t1 = 111;
Integer t2 = 111;
Integer t3 = new Integer(111);
Integer t4 = Integer.valueOf(111);
Integer s1 = 222;
Integer s2 = 222;
Integer s3 = new Integer(222);
Integer s4 = Integer.valueOf(222);
System.out.println(t1 == t2); //true
System.out.println(t1 == t3); //false
System.out.println(t1 == t4); //true
System.out.println(s1 == s2); //false
System.out.println(s1 == s3); //false
System.out.println(s1 == s4); //false

2 String
String a = "JAVA";
String b = "JAVA";
String c = new String("JAVA");
String d = "JA";
String e = "VA";
String f = "JA"+"VA";
String g = d+e;
String h = c ;
System.out.println(a==b); //true
System.out.println(a==c); //false
System.out.println(a==f); //true
System.out.println(a==g); //false
System.out.println(c==f); //false
System.out.println(c==g); //false
System.out.println(c==h); //true
3.数组,=
int a=0;
int b[]=new int[5];
int c=3;
b[a]=a=c;
System.out.println(b[0] + " " + b[3]); //3 0
4 static
static {
name = "B";
}
static String name = "A";
static {
System.out.println(name); //A
}
输出的name 是什么呢?
5.short
short a = 1;
a = a ++;//会报错吗? 不会
short a = 1;
a = a + 1;//会报错吗? 会
short a = 1;
a += 1;// 会报错吗? 不会

原地址http://user.qzone.qq.com/243404061/2

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

required

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据