Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should use primitive types unless you need an object .<br> wrapper class can be <code>null</code> but primitive types Ex: <code>Integer</code> can be <code>null</code>, <code>int</code> can't. </p> <p>This is <a href="http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html" rel="nofollow">primitive data type</a> initialization : </p> <pre><code>int pInt = 500; </code></pre> <p>This is creating wrapper class for same primitive data type:</p> <pre><code>Integer wInt = new Integer(pInt); </code></pre> <p><strong>The <a href="http://en.wikipedia.org/wiki/Primitive_wrapper_class" rel="nofollow">wrapper classes</a> in the Java API serve two primary purposes:</strong> </p> <ul> <li>To provide a mechanism to “wrap” primitive values in an object so that the primitives can be included in activities reserved for objects, like as being added to Collections, or returned from a method with an object return value.</li> <li>To provide an assortment of utility functions for primitives. Most of these functions are related to various conversions: converting primitives to and from String objects, and converting primitives and String objects to and from different bases (or radix), such as binary, octal, and hexadecimal.</li> </ul> <p>In <strong>Java 1.5</strong> there is one concept called <a href="http://docs.oracle.com/javase/1.5.0/docs/guide/language/autoboxing.html" rel="nofollow">Autoboxing</a>. It has a capability to convert or cast between object wrapper and it's primitive type.</p> <p>SO that means: </p> <pre><code>Integer wInt = 500; int pInt = new Integer(500); </code></pre> <p>It can be possible due to Autoboxing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload