{"id":87171,"date":"2024-12-07T10:03:40","date_gmt":"2024-12-07T06:33:40","guid":{"rendered":"https:\/\/nabfollower.com\/blog\/fundamentos-do-autoboxing-e-os-metodos-4pb8\/"},"modified":"2024-12-07T10:03:40","modified_gmt":"2024-12-07T06:33:40","slug":"fundamentos-do-autoboxing-e-os-metodos-4pb8","status":"publish","type":"post","link":"https:\/\/nabfollower.com\/blog\/fundamentos-do-autoboxing-e-os-metodos-4pb8\/","title":{"rendered":"\u0645\u0628\u0627\u0646\u06cc \u0627\u062a\u0648\u0628\u0627\u06a9\u0633\u06cc\u0646\u06af \u0648 \u0631\u0648\u0634 \u0647\u0627"},"content":{"rendered":"<p>Summarize this content to 400 words in Persian Lang<br \/>\n              \u062a\u0639\u0631\u06cc\u0641<\/p>\n<p>Autoboxing: \u062a\u0628\u062f\u06cc\u0644 \u062e\u0648\u062f\u06a9\u0627\u0631 \u06cc\u06a9 \u0646\u0648\u0639 \u0627\u0648\u0644\u06cc\u0647 \u0628\u0647 \u0645\u0639\u0627\u062f\u0644 \u0645\u062d\u0635\u0648\u0631\u06a9\u0646\u0646\u062f\u0647 \u0646\u0648\u0639 \u0622\u0646 (\u0645\u0627\u0646\u0646\u062f int \u0628\u0647 \u0639\u062f\u062f \u0635\u062d\u06cc\u062d).<br \/>\nAutounboxing: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u062e\u0648\u062f\u06a9\u0627\u0631 \u0645\u0642\u062f\u0627\u0631 \u0627\u0632 \u06cc\u06a9 \u0646\u0648\u0639 wrapper \u0628\u0647 \u0646\u0648\u0639 \u0627\u0648\u0644\u06cc\u0647 \u0622\u0646 (\u0645\u0627\u0646\u0646\u062f Integer \u0628\u0647 int).<\/p>\n<p>\u0645\u0632\u0627\u06cc\u0627<\/p>\n<p>\u06a9\u062f \u0631\u0627 \u0628\u0627 \u062d\u0630\u0641 \u0646\u06cc\u0627\u0632 \u0628\u0647 \u062a\u0628\u062f\u06cc\u0644 \u0647\u0627\u06cc \u062f\u0633\u062a\u06cc \u0633\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u062f.<br \/>\n\u062f\u0631 \u0647\u0646\u06af\u0627\u0645 \u0628\u0631\u062e\u0648\u0631\u062f \u0628\u0627 \u0627\u0646\u0648\u0627\u0639 \u0627\u0648\u0644\u06cc\u0647 \u0648 \u06a9\u067e\u0633\u0648\u0644\u0627\u062a\u0648\u0631\u0647\u0627 \u0627\u062d\u062a\u0645\u0627\u0644 \u062e\u0637\u0627 \u0631\u0627 \u06a9\u0627\u0647\u0634 \u0645\u06cc \u062f\u0647\u062f.<br \/>\n\u0628\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0627\u0646\u0648\u0627\u0639 \u0627\u0648\u0644\u06cc\u0647 \u062f\u0631 \u0632\u0645\u06cc\u0646\u0647 \u0647\u0627\u06cc\u06cc \u06a9\u0647 \u0627\u0634\u06cc\u0627\u0621 \u0645\u0648\u0631\u062f \u0627\u0646\u062a\u0638\u0627\u0631 \u0647\u0633\u062a\u0646\u062f \u0627\u062c\u0627\u0632\u0647 \u0645\u06cc \u062f\u0647\u062f.<\/p>\n<p>\u0646\u0645\u0648\u0646\u0647 \u0627\u06cc \u0627\u0632 \u0627\u062a\u0648\u0628\u0627\u06a9\u0633\u06cc\u0646\u06af<\/p>\n<p>Integer iOb = 100; \/\/ O valor int 100 \u00e9 encapsulado automaticamente.<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0628\u062f\u0648\u0646 \u0627\u062a\u0648\u0628\u0627\u06a9\u0633 (\u0642\u0628\u0644 \u0627\u0632 JDK 5):<\/p>\n<p>Integer iOb = new Integer(100);<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0646\u0645\u0648\u0646\u0647 \u0627\u062a\u0648\u0622\u0646\u0628\u0627\u06a9\u0633\u06cc\u0646\u06af<\/p>\n<p>int i = iOb; \/\/ O valor encapsulado em iOb \u00e9 extra\u00eddo automaticamente.<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 autounboxing (\u0642\u0628\u0644 \u0627\u0632 JDK 5) \u0627\u0633\u062a:<\/p>\n<p>int i = iOb.intValue();<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0646\u0633\u062e\u0647 \u06cc \u0646\u0645\u0627\u06cc\u0634\u06cc \u0627\u0648\u0644\u06cc\u0647<\/p>\n<p>class AutoBox {<br \/>\n    public static void main(String[] args) {<br \/>\n        Integer iOb = 100; \/\/ Autoboxing<br \/>\n        int i = iOb; \/\/ Autounboxing<\/p>\n<p>        System.out.println(i + &#8221; &#8221; + iOb); \/\/ Exibe: 100 100<br \/>\n    }<br \/>\n}<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u062f\u0631 \u0631\u0648\u0634 \u0647\u0627\u0627\u062a\u0648\u0628\u0627\u06a9\u0633\u06cc\u0646\u06af \u0648 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc \u0631\u0648\u0634<\/p>\n<p>static void m(Integer v) {<br \/>\n    System.out.println(&#8220;m() received &#8221; + v);<br \/>\n}<\/p>\n<p>public static void main(String[] args) {<br \/>\n    m(199); \/\/ 199 \u00e9 encapsulado automaticamente em um Integer.<br \/>\n}<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>Autounboxing \u0648 \u0627\u0631\u0632\u0634 \u0647\u0627\u06cc \u0628\u0627\u0632\u06af\u0634\u062a\u06cc<\/p>\n<p>static int m2() {<br \/>\n    return 10; \/\/ Retorna um int.<br \/>\n}<\/p>\n<p>static Integer m3() {<br \/>\n    return 99; \/\/ Retorna um Integer (autoboxing de 99).<br \/>\n}<\/p>\n<p>public static void main(String[] args) {<br \/>\n    Integer iOb = m2(); \/\/ Autoboxing do valor retornado (10).<br \/>\n    int i = m3(); \/\/ Autounboxing do Integer retornado (99).<\/p>\n<p>    System.out.println(&#8220;Return value from m2() is &#8221; + iOb);<br \/>\n    System.out.println(&#8220;Return value from m3() is &#8221; + i);<br \/>\n}<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0645\u062b\u0627\u0644 \u06a9\u0627\u0645\u0644<\/p>\n<p>class AutoBox2 {<br \/>\n    static void m(Integer v) {<br \/>\n        System.out.println(&#8220;m() received &#8221; + v);<br \/>\n    }<\/p>\n<p>    static int m2() {<br \/>\n        return 10;<br \/>\n    }<\/p>\n<p>    static Integer m3() {<br \/>\n        return 99;<br \/>\n    }<\/p>\n<p>    public static void main(String[] args) {<br \/>\n        \/\/ Autoboxing ao passar argumento<br \/>\n        m(199);<\/p>\n<p>        \/\/ Autoboxing ao atribuir retorno de um int a um Integer<br \/>\n        Integer iOb = m2();<br \/>\n        System.out.println(&#8220;Return value from m2() is &#8221; + iOb);<\/p>\n<p>        \/\/ Autounboxing ao atribuir retorno de um Integer a um int<br \/>\n        int i = m3();<br \/>\n        System.out.println(&#8220;Return value from m3() is &#8221; + i);<\/p>\n<p>        \/\/ Autounboxing em opera\u00e7\u00f5es<br \/>\n        iOb = 100;<br \/>\n        System.out.println(&#8220;Square root of iOb is &#8221; + Math.sqrt(iOb));<br \/>\n    }<br \/>\n}<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u062e\u0631\u0648\u062c \u0627\u0632 \u0628\u0631\u0646\u0627\u0645\u0647<\/p>\n<p>m() received 199<br \/>\nReturn value from m2() is 10<br \/>\nReturn value from m3() is 99<br \/>\nSquare root of iOb is 10.0<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<p>\u0645\u0634\u0627\u0647\u062f\u0627\u062a<\/p>\n<p>\u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627 \u0648 \u0628\u0627\u0632\u062f\u0647:<\/p>\n<p>\u0622\u0631\u06af\u0648\u0645\u0627\u0646\u200c\u0647\u0627\u06cc \u0627\u0628\u062a\u062f\u0627\u06cc\u06cc \u0628\u0647 \u0631\u0648\u0634\u200c\u0647\u0627\u06cc\u06cc \u0645\u0646\u062a\u0642\u0644 \u0645\u06cc\u200c\u0634\u0648\u0646\u062f \u06a9\u0647 \u0627\u0646\u062a\u0638\u0627\u0631 \u062f\u0627\u0631\u0646\u062f wrapper\u200c\u0647\u0627 \u062e\u0648\u062f\u06a9\u0627\u0631 \u0628\u0627\u0634\u0646\u062f.<br \/>\n\u0645\u0642\u0627\u062f\u06cc\u0631 \u0628\u0627\u0632\u06af\u0631\u062f\u0627\u0646\u062f\u0647 \u0634\u062f\u0647 \u0627\u0632 \u0631\u0648\u0634 \u0647\u0627 \u0631\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646 \u0628\u0647 \u0637\u0648\u0631 \u062e\u0648\u062f\u06a9\u0627\u0631 \u062f\u0631 \u0635\u0648\u0631\u062a \u0646\u06cc\u0627\u0632 \u06a9\u067e\u0633\u0648\u0644\u0647 \u06cc\u0627 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u06a9\u0631\u062f.<\/p>\n<p>\u0646\u0648\u0639 \u062a\u0628\u0644\u06cc\u063a\u0627\u062a:\u062f\u0631 \u062d\u06cc\u0646 \u062c\u0639\u0628\u0647\u200c\u06af\u0634\u0627\u06cc\u06cc \u062e\u0648\u062f\u06a9\u0627\u0631\u060c \u062f\u0631 \u0635\u0648\u0631\u062a \u0644\u0632\u0648\u0645\u060c \u0646\u0648\u0639 \u06a9\u067e\u0633\u0648\u0644\u0647\u200c\u0634\u062f\u0647 \u0628\u0631\u0627\u06cc \u0628\u0631\u0622\u0648\u0631\u062f\u0647 \u06a9\u0631\u062f\u0646 \u0634\u0631\u0627\u06cc\u0637 \u0632\u0645\u06cc\u0646\u0647 \u0627\u0631\u062a\u0642\u0627 \u0645\u06cc\u200c\u06cc\u0627\u0628\u062f (\u0645\u062b\u0627\u0644: \u0639\u062f\u062f \u0635\u062d\u06cc\u062d \u062f\u0631 Math.sqrt() \u062f\u0648 \u0628\u0631\u0627\u0628\u0631 \u0634\u0648\u062f).\u0627\u06cc\u0646 \u0645\u0641\u0627\u0647\u06cc\u0645 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0627\u0646\u0648\u0627\u0639 \u0648 \u0627\u0634\u06cc\u0627\u0621 \u0627\u0648\u0644\u06cc\u0647 \u062f\u0631 \u062c\u0627\u0648\u0627 \u0631\u0627 \u0628\u0635\u0631\u06cc \u0648 \u06a9\u0627\u0631\u0622\u0645\u062f\u062a\u0631 \u0645\u06cc \u06a9\u0646\u062f.<\/p>\n<div data-article-id=\"2142613\" id=\"article-body\">\n<p><strong>\u062a\u0639\u0631\u06cc\u0641<\/strong><\/p>\n<ul>\n<li>Autoboxing: \u062a\u0628\u062f\u06cc\u0644 \u062e\u0648\u062f\u06a9\u0627\u0631 \u06cc\u06a9 \u0646\u0648\u0639 \u0627\u0648\u0644\u06cc\u0647 \u0628\u0647 \u0645\u0639\u0627\u062f\u0644 \u0645\u062d\u0635\u0648\u0631\u06a9\u0646\u0646\u062f\u0647 \u0646\u0648\u0639 \u0622\u0646 (\u0645\u0627\u0646\u0646\u062f int \u0628\u0647 \u0639\u062f\u062f \u0635\u062d\u06cc\u062d).<\/li>\n<li>Autounboxing: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u062e\u0648\u062f\u06a9\u0627\u0631 \u0645\u0642\u062f\u0627\u0631 \u0627\u0632 \u06cc\u06a9 \u0646\u0648\u0639 wrapper \u0628\u0647 \u0646\u0648\u0639 \u0627\u0648\u0644\u06cc\u0647 \u0622\u0646 (\u0645\u0627\u0646\u0646\u062f Integer \u0628\u0647 int).<\/li>\n<\/ul>\n<p><strong>\u0645\u0632\u0627\u06cc\u0627<\/strong><\/p>\n<ul>\n<li>\u06a9\u062f \u0631\u0627 \u0628\u0627 \u062d\u0630\u0641 \u0646\u06cc\u0627\u0632 \u0628\u0647 \u062a\u0628\u062f\u06cc\u0644 \u0647\u0627\u06cc \u062f\u0633\u062a\u06cc \u0633\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u062f.<\/li>\n<li>\u062f\u0631 \u0647\u0646\u06af\u0627\u0645 \u0628\u0631\u062e\u0648\u0631\u062f \u0628\u0627 \u0627\u0646\u0648\u0627\u0639 \u0627\u0648\u0644\u06cc\u0647 \u0648 \u06a9\u067e\u0633\u0648\u0644\u0627\u062a\u0648\u0631\u0647\u0627 \u0627\u062d\u062a\u0645\u0627\u0644 \u062e\u0637\u0627 \u0631\u0627 \u06a9\u0627\u0647\u0634 \u0645\u06cc \u062f\u0647\u062f.<\/li>\n<li>\u0628\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0627\u0646\u0648\u0627\u0639 \u0627\u0648\u0644\u06cc\u0647 \u062f\u0631 \u0632\u0645\u06cc\u0646\u0647 \u0647\u0627\u06cc\u06cc \u06a9\u0647 \u0627\u0634\u06cc\u0627\u0621 \u0645\u0648\u0631\u062f \u0627\u0646\u062a\u0638\u0627\u0631 \u0647\u0633\u062a\u0646\u062f \u0627\u062c\u0627\u0632\u0647 \u0645\u06cc \u062f\u0647\u062f.<\/li>\n<\/ul>\n<p>\u0646\u0645\u0648\u0646\u0647 \u0627\u06cc \u0627\u0632 \u0627\u062a\u0648\u0628\u0627\u06a9\u0633\u06cc\u0646\u06af<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>Integer iOb = 100; \/\/ O valor int 100 \u00e9 encapsulado automaticamente.\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0628\u062f\u0648\u0646 \u0627\u062a\u0648\u0628\u0627\u06a9\u0633 (\u0642\u0628\u0644 \u0627\u0632 JDK 5):<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>Integer iOb = new Integer(100);\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0646\u0645\u0648\u0646\u0647 \u0627\u062a\u0648\u0622\u0646\u0628\u0627\u06a9\u0633\u06cc\u0646\u06af<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>int i = iOb; \/\/ O valor encapsulado em iOb \u00e9 extra\u00eddo automaticamente.\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 autounboxing (\u0642\u0628\u0644 \u0627\u0632 JDK 5) \u0627\u0633\u062a:<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>int i = iOb.intValue();\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>\u0646\u0633\u062e\u0647 \u06cc \u0646\u0645\u0627\u06cc\u0634\u06cc \u0627\u0648\u0644\u06cc\u0647<\/strong><\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class AutoBox {\n    public static void main(String[] args) {\n        Integer iOb = 100; \/\/ Autoboxing\n        int i = iOb; \/\/ Autounboxing\n\n        System.out.println(i + \" \" + iOb); \/\/ Exibe: 100 100\n    }\n}\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>\u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u062f\u0631 \u0631\u0648\u0634 \u0647\u0627<\/strong><br \/>\u0627\u062a\u0648\u0628\u0627\u06a9\u0633\u06cc\u0646\u06af \u0648 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc \u0631\u0648\u0634<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>static void m(Integer v) {\n    System.out.println(\"m() received \" + v);\n}\n\npublic static void main(String[] args) {\n    m(199); \/\/ 199 \u00e9 encapsulado automaticamente em um Integer.\n}\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>Autounboxing \u0648 \u0627\u0631\u0632\u0634 \u0647\u0627\u06cc \u0628\u0627\u0632\u06af\u0634\u062a\u06cc<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>static int m2() {\n    return 10; \/\/ Retorna um int.\n}\n\nstatic Integer m3() {\n    return 99; \/\/ Retorna um Integer (autoboxing de 99).\n}\n\npublic static void main(String[] args) {\n    Integer iOb = m2(); \/\/ Autoboxing do valor retornado (10).\n    int i = m3(); \/\/ Autounboxing do Integer retornado (99).\n\n    System.out.println(\"Return value from m2() is \" + iOb);\n    System.out.println(\"Return value from m3() is \" + i);\n}\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u0645\u062b\u0627\u0644 \u06a9\u0627\u0645\u0644<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>class AutoBox2 {\n    static void m(Integer v) {\n        System.out.println(\"m() received \" + v);\n    }\n\n    static int m2() {\n        return 10;\n    }\n\n    static Integer m3() {\n        return 99;\n    }\n\n    public static void main(String[] args) {\n        \/\/ Autoboxing ao passar argumento\n        m(199);\n\n        \/\/ Autoboxing ao atribuir retorno de um int a um Integer\n        Integer iOb = m2();\n        System.out.println(\"Return value from m2() is \" + iOb);\n\n        \/\/ Autounboxing ao atribuir retorno de um Integer a um int\n        int i = m3();\n        System.out.println(\"Return value from m3() is \" + i);\n\n        \/\/ Autounboxing em opera\u00e7\u00f5es\n        iOb = 100;\n        System.out.println(\"Square root of iOb is \" + Math.sqrt(iOb));\n    }\n}\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>\u062e\u0631\u0648\u062c \u0627\u0632 \u0628\u0631\u0646\u0627\u0645\u0647<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>m() received 199\nReturn value from m2() is 10\nReturn value from m3() is 99\nSquare root of iOb is 10.0\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><strong>\u0645\u0634\u0627\u0647\u062f\u0627\u062a<\/strong><\/p>\n<p><strong>\u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627 \u0648 \u0628\u0627\u0632\u062f\u0647:<\/strong><\/p>\n<ul>\n<li>\u0622\u0631\u06af\u0648\u0645\u0627\u0646\u200c\u0647\u0627\u06cc \u0627\u0628\u062a\u062f\u0627\u06cc\u06cc \u0628\u0647 \u0631\u0648\u0634\u200c\u0647\u0627\u06cc\u06cc \u0645\u0646\u062a\u0642\u0644 \u0645\u06cc\u200c\u0634\u0648\u0646\u062f \u06a9\u0647 \u0627\u0646\u062a\u0638\u0627\u0631 \u062f\u0627\u0631\u0646\u062f wrapper\u200c\u0647\u0627 \u062e\u0648\u062f\u06a9\u0627\u0631 \u0628\u0627\u0634\u0646\u062f.<\/li>\n<li>\u0645\u0642\u0627\u062f\u06cc\u0631 \u0628\u0627\u0632\u06af\u0631\u062f\u0627\u0646\u062f\u0647 \u0634\u062f\u0647 \u0627\u0632 \u0631\u0648\u0634 \u0647\u0627 \u0631\u0627 \u0645\u06cc \u062a\u0648\u0627\u0646 \u0628\u0647 \u0637\u0648\u0631 \u062e\u0648\u062f\u06a9\u0627\u0631 \u062f\u0631 \u0635\u0648\u0631\u062a \u0646\u06cc\u0627\u0632 \u06a9\u067e\u0633\u0648\u0644\u0647 \u06cc\u0627 \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u06a9\u0631\u062f.<\/li>\n<\/ul>\n<p><strong>\u0646\u0648\u0639 \u062a\u0628\u0644\u06cc\u063a\u0627\u062a:<\/strong><br \/><strong>\u062f\u0631 \u062d\u06cc\u0646 \u062c\u0639\u0628\u0647\u200c\u06af\u0634\u0627\u06cc\u06cc \u062e\u0648\u062f\u06a9\u0627\u0631\u060c \u062f\u0631 \u0635\u0648\u0631\u062a \u0644\u0632\u0648\u0645\u060c \u0646\u0648\u0639 \u06a9\u067e\u0633\u0648\u0644\u0647\u200c\u0634\u062f\u0647 \u0628\u0631\u0627\u06cc \u0628\u0631\u0622\u0648\u0631\u062f\u0647 \u06a9\u0631\u062f\u0646 \u0634\u0631\u0627\u06cc\u0637 \u0632\u0645\u06cc\u0646\u0647 \u0627\u0631\u062a\u0642\u0627 \u0645\u06cc\u200c\u06cc\u0627\u0628\u062f (\u0645\u062b\u0627\u0644: \u0639\u062f\u062f \u0635\u062d\u06cc\u062d \u062f\u0631 Math.sqrt() \u062f\u0648 \u0628\u0631\u0627\u0628\u0631 \u0634\u0648\u062f).<br \/>\u0627\u06cc\u0646 \u0645\u0641\u0627\u0647\u06cc\u0645 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0627\u0646\u0648\u0627\u0639 \u0648 \u0627\u0634\u06cc\u0627\u0621 \u0627\u0648\u0644\u06cc\u0647 \u062f\u0631 \u062c\u0627\u0648\u0627 \u0631\u0627 \u0628\u0635\u0631\u06cc \u0648 \u06a9\u0627\u0631\u0622\u0645\u062f\u062a\u0631 \u0645\u06cc \u06a9\u0646\u062f.<\/strong><\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Summarize this content to 400 words in Persian Lang \u062a\u0639\u0631\u06cc\u0641 Autoboxing: \u062a\u0628\u062f\u06cc\u0644 \u062e\u0648\u062f\u06a9\u0627\u0631 \u06cc\u06a9 \u0646\u0648\u0639 \u0627\u0648\u0644\u06cc\u0647 \u0628\u0647 \u0645\u0639\u0627\u062f\u0644 \u0645\u062d\u0635\u0648\u0631\u06a9\u0646\u0646\u062f\u0647 \u0646\u0648\u0639 \u0622\u0646 (\u0645\u0627\u0646\u0646\u062f int \u0628\u0647 \u0639\u062f\u062f \u0635\u062d\u06cc\u062d). Autounboxing: \u0627\u0633\u062a\u062e\u0631\u0627\u062c \u062e\u0648\u062f\u06a9\u0627\u0631 \u0645\u0642\u062f\u0627\u0631 \u0627\u0632 \u06cc\u06a9 \u0646\u0648\u0639 wrapper \u0628\u0647 \u0646\u0648\u0639 \u0627\u0648\u0644\u06cc\u0647 \u0622\u0646 (\u0645\u0627\u0646\u0646\u062f Integer \u0628\u0647 int). \u0645\u0632\u0627\u06cc\u0627 \u06a9\u062f \u0631\u0627 \u0628\u0627 \u062d\u0630\u0641 \u0646\u06cc\u0627\u0632 \u0628\u0647 \u062a\u0628\u062f\u06cc\u0644 \u0647\u0627\u06cc \u062f\u0633\u062a\u06cc \u0633\u0627\u062f\u0647 \u0645\u06cc \u06a9\u0646\u062f. &hellip;<\/p>\n","protected":false},"author":2,"featured_media":87172,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[339],"tags":[],"class_list":["post-87171","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/87171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/comments?post=87171"}],"version-history":[{"count":0,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/87171\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media\/87172"}],"wp:attachment":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media?parent=87171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/categories?post=87171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/tags?post=87171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}