?????? ????????MethodArea??

???????????????????????????????????????η?????????е????????????ж????final?????????????е?Field????????е????????????????????????????Class?????е?getName??isInterface??????????????????Щ??????????????????????????????????????????????????????????????????????????????????????????GC?????????????????????泬??????????С????????OutOfMemory??????????

??????Sun JDK??????????????PermanetGeneration????????????????64M???????-XX??PermSize???-XX??MaxPermSize????????С??

?????? ????????????RuntimeConstant Pool??

????????C?е??????????????е???????????????????Field?????????????????????????з????????????????????class?????java????????????????

?????? ????????????NativeMethod Stacks??

????JVM??????????????????native????????У???????????洢???native?????????????

???????????????δ???
public class A {
                   public static void main(String[]args){
           String a="a";
          String b="b";
           String ab="ab";
           System.out.println((a+b)==ab);       // false
           System.out.println(("a"+"b")==ab);   // true
           final String afinal="a";
           String result=afinal+"b";
           System.out.println(result==ab);      // true
           String plus=a+"b";
           System.out.println(plus==ab);        // false
             System.out.println(plus.intern()==ab);  // true
    }
}

???????????????????е??????????javap –verbose A??????????????

?????? (a+b)==ab

????a+b?????????????????????????????????????????????JVM??????????????????μ???????a+b==ab?????false??

?????? (“a”+”b”)==ab

????“a”+”b”?????????????JVM?????????”ab”??????????ab=”ab”?????????????????????????????????(“a”+”b”)==ab?true??

?????? result==ab

????result=afinal+”b”??afinal???final??????? result??????????????????”ab”????”ab”???????????????????????result==ab?true??

?????? plus=ab

????plus??a+b????????????????plus==ab?false??

?????? plus.intern()==ab

??????????????????????plus.intern()???????????????????????plus????????????????plus.intern()==ab?true??

????????????JVM?????????????????????????JVM???????????????????????????????????Heap???Method Area?????????????????????????JVM??????????????????й????