????????????????????????????????????????????????????????д?????????????????
????1 ==???????
???????????α????????????
????<code class=" hljs cs">Integer a = 1000??b=1000; 
????Integer c = 100??d=100;   
????public void mRun(final String name){ 
????new Runnable() { 
????public void run() { 
????System.out.println(name); 
????} 
????}; 
????} 
????System.out.println(a==b); 
????System.out.println(c==d);  </code>
????????????????ó??????????????????е?????????????????????????????? ?? true ??true????????????????????
????????????′??? ???д?????????? false true?????????==?????????????????????????abcd??????????????????????????????false???????????????????????????????????????????????????????????????????????????????????Integer.java???????????
????<code class=" hljs java">public static Integer valueOf(int i) { 
????return  i >= 128 || i < -128 ? new Integer(i) : SMALL_VALUES[i + 128]; 
????} 
????/**
????* A cache of instances used by {@link Integer#valueOf(int)} and auto-boxing
????*/
????private static final Integer[] SMALL_VALUES = new Integer[256]; 
????static { 
????for (int i = -128; i < 128; i++) { 
????SMALL_VALUES[i + 128] = new Integer(i); 
????} 
????}  </code>
?????????????????Integer c = 100;???????????????????????????????????????????????????Integer???????????Integer????????????valueOf???????????????Integer?а?-128-127 ?????????????????????С????????????????????????????????????????????????????????????????????????false??ture???????????Integer????????-128-127??????????????????????????????true??
????2 String
????<code class=" hljs vhdl">String s1 = "abc"; 
????String s2 = "abc"; 
????String s3 = new String("abc"); 
????System.out.println(s1 == s2); 
????System.out.println(s1 == s3);  </code>
?????????????????????????????
????????==?????????? ????s1??s2??s3????????????????????????????????false?????????????н????true??false??????????false???????????????true???????????????????Щ?????????????????????????????????????????з????????????????new ?????????????顣????????????????????????????????????????String s1 = “abc”; ????????????????????????洢????????С??????????String s1 = “abc”??????????????”abc”?洢?????????????????????????У??????????????String s2 = “abc” ?????Java????????????????в?????????”abc”?????????????s2????????????????′???????????????????????????????С????????????true ??false?????
????3 final?????
????<code class=" hljs cs">public void mRun(final String name){ 
????new Runnable() { 
????public void run() { 
????try { 
????Thread.sleep(1000); 
????} catch (InterruptedException e) { 
????// TODO Auto-generated catch block 
????e.printStackTrace(); 
????}   
????System.out.println(name); 
????} 
????}.start(); 
????}  </code>
?????????????????д????????????????????????????????????????final???η??????????????????????????????????????????????????????????final???η???????????С??鶼?????????????????????????????????????????????????е???????????????????????????????????????????????????????
????????????????????£???????final???????????????????????????????????????????????????????????????????????????????????????mRun??????У?new ????????У??????????????????????????У?mRun???????name?????????????????1?????Syetem.out.printh(name)??С???????name????????????????????????Java??????????????????????????з?λ????????????????final????????Ρ??????????final??????????????????б????????????????????????????????????????????????????????????????????????????????????????Java?????????????????????????????????????ж???С???????????????????????????
????4 Integer??int??Щ??
????<code class=" hljs vhdl">Integer a = new Integer(1000); 
????int b = 1000; 
????Integer c = new Integer(10); 
????Integer d = new Integer(10); 
????System.out.println(a == b); 
????System.out.println(c == d);  </code>
???????????????????????????????????????ó?????????????==?????????????????????
??????????? true ??false
????????????????С??????????????μ????????????????Integer?????-128-127?????????????????????true????????????????????Integer?????????new??????????????????棬????????false?? ???????????????????true????? ???????????1000????????????????Integer??????й??????????????й????a????new???????????????????????false???????????b??????int???????int??Integer????==???????Java???Integer???????????????Integer???int???????????????б?????int?????????????????true??