A detailed description of binning in Java

Source: Internet
Author: User

 

Package advancejava; public class box {public static void main (string ARGs []) {integer a = 127; integer B = 127; system. out. println (A = B); integer c = 128; integer d = 128; system. out. println (C = D);/** if the size of the integer closed object * is within one byte, -128-127 * puts the encapsulated object in the constant pool, * If the encapsulated object is larger than one byte * Put It In The heap * This is the above * A = B * C! = D; ** this is a metadata-Sharing Mode */}}

Package advancejava; import static Java. lang. system. *; public class box {public static void main (string ARGs []) {integer a = 1; integer B = 2; integer c = 3; integer d = 3; integer e = 321; integer F = 321; long G = 3l; out. println (C = D); out. println (E = f); out. println (C = (a + B); out. println (C. equals (A + B); out. println (G = (a + B); out. println (G. equals (A + B); out. println ("--------");/** if If the size of an integer closed object * is within one byte, that is,-128-127 *, the encapsulated object is placed in the constant pool, * If the encapsulated object is larger than one byte * Put It In The heap * This is the above * A = B * C! = D; ** this is a metadata-Sharing Mode */}}

Package advancejava; import static Java. lang. system. *; public class box {public static void main (string ARGs []) {integer a = 1; integer B = 2; integer c = 3; integer d = 3; integer e = 321; integer F = 321; long G = 3l; out. println (C = D); out. println (E = f); out. println (C = (a + B); out. println (C. equals (A + B); out. println (G = (a + B); out. println (G. equals (A + B); out. println ("--------");/** if If the size of an integer closed object * is within one byte, that is,-128-127 *, the encapsulated object is placed in the constant pool, * If the encapsulated object is larger than one byte * Put It In The heap * This is the above * A = B * C! = D; ** this is a metadata mode */}/* decompiled Code * integer a = integer. valueof (1); integer B = integer. valueof (2 );

Integer c = integer. valueof (3); integer d = integer. valueof (3); integer e = integer. valueof (321); integer F = integer. valueof (321); long G = long. valueof (3l); system. out. println (C = D); system. out. println (E = f); system. out. println (C. intvalue () =. intvalue () + B. intvalue (); system. out. println (C. equals (integer. valueof (. intvalue () + B. intvalue (); system. out. println (G. longvalue () =. intvalue () + B. intvalue (); system. out. println (G. equals (integer. valueof (. intvalue () + B. intvalue ())));**/

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.