Skip to content

Commit 1811d00

Browse files
committed
“****”
1 parent 0f0fde1 commit 1811d00

6 files changed

Lines changed: 66 additions & 8 deletions

File tree

837 Bytes
Binary file not shown.
822 Bytes
Binary file not shown.
1018 Bytes
Binary file not shown.

‎src/com/duweri/interview/Test.java‎

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,29 @@ public class Test {
55
/**
66
* @param args
77
*/
8-
public static void main(String[] args) {
9-
10-
int[][] arr = new int[3][4];
11-
12-
System.out.println(arr.length);
13-
14-
15-
}
8+
// public static void main(String[] args) {
9+
//
10+
// int[][] arr = new int[3][4];
11+
//
12+
// System.out.println(arr.length);
13+
//
14+
//
15+
// }
16+
17+
18+
19+
private static final String MESSAGE="taobao";
20+
public static void main(String [] args) {
21+
String a ="tao"+"bao";//在池中创建tao和bao,并指向“taobao”对象
22+
String b="tao";//指向池中的tao
23+
String c="bao";//指向池中的bao
24+
String d = b+c;//堆中创建d
25+
System.out.println(a==MESSAGE);
26+
System.out.println("-------------");
27+
System.out.println((b+c)==MESSAGE);//对象
28+
29+
System.out.println(d.hashCode()+"+"+MESSAGE.hashCode());
30+
System.out.println((b+c).length()+"+"+MESSAGE.length());
31+
}
1632

1733
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.duweri.interview.string;
2+
3+
public class Test1 {
4+
5+
public static void main(String[] args) {
6+
7+
String s1="abc"+"def";//1 ³Ø
8+
String s2=new String(s1);//2 ¶Ñ
9+
if(s1.equals(s2))//3
10+
System.out.println(".equals succeeded");//4
11+
if(s1==s2)//5 X
12+
System.out.println("==succeeded");//6
13+
14+
}
15+
16+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.duweri.interview.string;
2+
3+
public class Test2 {
4+
5+
/**
6+
* @param args
7+
*/
8+
public static void main(String[] args) {
9+
// TODO Auto-generated method stub
10+
11+
Integer i01=59;
12+
int i02=59;
13+
Integer i03=Integer.valueOf(59);
14+
Integer i04=new Integer(59);
15+
16+
17+
System.out.println(i01 == i02);//true
18+
19+
System.out.println(i01 == i03);//true
20+
21+
System.out.println(i03 == i04);//false
22+
23+
System.out.println(i02 == i04);//true
24+
}
25+
26+
}

0 commit comments

Comments
 (0)