Content deleted Content added
Revision (3-14-2016) in accordance with Wikipedia encyclopedia formatting style and tone |
Sammi Brie (talk | contribs) Adding intentionally blank description, overriding Wikidata description "computer term referring to a Java class in object-oriented programming" |
||
(30 intermediate revisions by 26 users not shown) | |||
Line 1:
{{Short description|none}}
In [[object
Primitive wrapper classes are used to create an {{Javadoc:SE|java/lang|Object}} that needs to represent primitive types in {{Javadoc:SE|java/util|Collection}} classes (i.e., in the Java API), in the {{Javadoc:SE|package=java.util|java/util}} package and in the {{Javadoc:SE|package=java.lang.reflect|java/lang/reflect}} [[Reflection (computer science)|reflection]] package. Collection classes are Java API-defined classes that
The primitive wrapper classes and their corresponding primitive types are:
:{| class="wikitable"
! Primitive type !! Wrapper class !! Constructor
|-
| <code>byte</code> || {{Javadoc:SE|java/lang|Byte}} || <code>byte</code> or <code>String </code>
Line 25 ⟶ 26:
|}
==The difference between wrapper classes and primitive types==
Primitive wrapper classes are not the same thing as
Therefore, the term ''Primitive wrapper class'' does not mean that wrapper classes are primitive types. It should be understood to be a class that wraps primitive types. Wrapper classes can be used to store the same value as of a primitive type variable but the instances/objects of wrapper classes themselves are ''Non-Primitive''. We cannot say that Wrapper classes themselves are Primitive types. They just wrap the primitive types.
The <code>Byte</code>, <code>Short</code>, <code>Integer</code>, <code>Long</code>, <code>Float</code>, and <code>Double</code> wrapper classes are all [[subclass (computer science)|subclass]]es of the {{Javadoc:SE|java/lang|Number}} class.
The wrapper classes <code>BigDecimal</code> and <code>BigInteger
| url = http://www.javaranch.com/journal/2003/04/immutable.htm
| title = Mutable and Immutable Objects: Which classes are Immutable?
| author = David O'Meara
| date = April 2003
| publisher = Java Ranch
| accessdate = 2012-05-14
Line 50 ⟶ 49:
| quote = Immutable arbitrary-precision integers.
}}</ref>
== Atomic wrapper classes ==
Line 78 ⟶ 69:
The <code>AtomicInteger</code> and <code>AtomicLong</code> classes are subclasses of the <code>Number</code> class. The <code>AtomicReference</code> class accepts the [[TypeParameter|type parameter]] <code>V</code> that specifies the type of the object [[reference (computer science)|reference]]. (See "[[Generics in Java]]" for a description of type parameters in Java).
== See also ==
|