<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Primitive_wrapper_class_in_Java</id>
	<title>Primitive wrapper class in Java - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Primitive_wrapper_class_in_Java"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Primitive_wrapper_class_in_Java&amp;action=history"/>
	<updated>2026-04-22T13:40:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=Primitive_wrapper_class_in_Java&amp;diff=2420931&amp;oldid=prev</id>
		<title>imported&gt;Panamitsu at 03:42, 10 June 2025</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Primitive_wrapper_class_in_Java&amp;diff=2420931&amp;oldid=prev"/>
		<updated>2025-06-10T03:42:26Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In [[object-oriented programming]], a &amp;#039;&amp;#039;&amp;#039;wrapper class&amp;#039;&amp;#039;&amp;#039; is a [[class (computer programming)|class]] that [[Encapsulation (computer programming)|encapsulates]] [[data type|types]], so that those types can be used to create [[object (computer science)|object]] [[instance (computer science)|instances]] and [[method (computer programming)|methods]] in another class that needs those types. So a &amp;#039;&amp;#039;&amp;#039;primitive wrapper class&amp;#039;&amp;#039;&amp;#039; is a wrapper class that encapsulates, hides or &amp;#039;&amp;#039;wraps&amp;#039;&amp;#039; data types from the eight [[primitive data type]]s,&amp;lt;ref&amp;gt;S. J. Chapman, &amp;#039;&amp;#039;Introduction to Java&amp;#039;&amp;#039;, Prentice Hall, 1999.&amp;lt;/ref&amp;gt; so that these can be used to create instantiated objects with methods in another class or in other classes.&amp;lt;ref name=murach&amp;gt;J. Murach, &amp;#039;&amp;#039;Murach&amp;#039;s Java Programming&amp;#039;&amp;#039;, 4th Edition, Mike Murach and Associates, Inc., 2011.&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;J. R. Hubbard, &amp;#039;&amp;#039;Programming with Java&amp;#039;&amp;#039;, Schaum&amp;#039;s Outline Series/McGraw Hill, 1998.&amp;lt;/ref&amp;gt; The primitive wrapper classes are found in the [[Java API]].&lt;br /&gt;
&lt;br /&gt;
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 can store objects in a manner similar to how data structures like arrays store primitive data types like &amp;#039;&amp;#039;&amp;#039;int&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;double&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;long&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;char&amp;#039;&amp;#039;&amp;#039;, etc.,&amp;lt;ref name=murach/&amp;gt; but arrays store primitive data types while collections actually store objects.&lt;br /&gt;
&lt;br /&gt;
The primitive wrapper classes and their corresponding primitive types are:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Primitive type !! Wrapper class !! Constructor arguments &lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt;    || {{Javadoc:SE|java/lang|Byte}} || &amp;lt;code&amp;gt;byte&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;String &amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt;   || {{Javadoc:SE|java/lang|Short}} || &amp;lt;code&amp;gt;short&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;String&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;     || {{Javadoc:SE|java/lang|Integer}} || &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;String&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;    || {{Javadoc:SE|java/lang|Long}} || &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;String&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;float&amp;lt;/code&amp;gt;   || {{Javadoc:SE|java/lang|Float}} || &amp;lt;code&amp;gt;float&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;double&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;String&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;double&amp;lt;/code&amp;gt;  || {{Javadoc:SE|java/lang|Double}} || &amp;lt;code&amp;gt;double&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;String&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;char&amp;lt;/code&amp;gt;    || {{Javadoc:SE|java/lang|Character}} || &amp;lt;code&amp;gt;char&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt; || {{Javadoc:SE|java/lang|Boolean}} || &amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;String&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==The difference between wrapper classes and primitive types==&lt;br /&gt;
&lt;br /&gt;
Primitive wrapper classes are not the same thing as primitive types. Whereas variables, for example, can be declared in Java as data types &amp;#039;&amp;#039;&amp;#039;double&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;short&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;int&amp;#039;&amp;#039;&amp;#039;, etc.,  the primitive wrapper classes create instantiated objects and methods that inherit but hide the primitive data types, not like variables that are assigned the data type values.&amp;lt;ref name=murach/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Therefore, the term &amp;#039;&amp;#039;Primitive wrapper class&amp;#039;&amp;#039; 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 &amp;#039;&amp;#039;Non-Primitive&amp;#039;&amp;#039;. We cannot say that Wrapper classes themselves are Primitive types. They just wrap the primitive types.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;Byte&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Short&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Integer&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Long&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Float&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;Double&amp;lt;/code&amp;gt; wrapper classes are all [[subclass (computer science)|subclass]]es of the {{Javadoc:SE|java/lang|Number}} class.&lt;br /&gt;
&lt;br /&gt;
The wrapper classes &amp;lt;code&amp;gt;BigDecimal&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;BigInteger&amp;lt;/code&amp;gt; are not one of the primitive wrapper classes but are immutable.&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
 | url    = http://www.javaranch.com/journal/2003/04/immutable.htm&lt;br /&gt;
 | title  = Mutable and Immutable Objects: Which classes are Immutable?&lt;br /&gt;
 | author = David O&amp;#039;Meara &lt;br /&gt;
 | date   = April 2003&lt;br /&gt;
 | publisher  = Java Ranch&lt;br /&gt;
 | accessdate = 2012-05-14&lt;br /&gt;
 | quote  = The classes java.math.BigInteger and BigDecimal are not immutable either, although maybe they should have been. &lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
 | url    = http://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html&lt;br /&gt;
 | title  = Java documentation from oracle&lt;br /&gt;
 | author = Oracle &lt;br /&gt;
 | quote  = Immutable arbitrary-precision integers. &lt;br /&gt;
}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Atomic wrapper classes ==&lt;br /&gt;
&lt;br /&gt;
With Java 5.0, additional wrapper classes were introduced in the {{Javadoc:SE|package=java.util.concurrent.atomic|java/util/concurrent/atomic}} package. These classes are mutable and cannot be used as a replacement for the regular wrapper classes. Instead, they provide [[atomic operation]]s for addition, increment and assignment.&lt;br /&gt;
&lt;br /&gt;
The atomic wrapper classes and their corresponding types are:&lt;br /&gt;
&lt;br /&gt;
:{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Primitive type !! Wrapper class&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;int&amp;lt;/code&amp;gt;     || {{Javadoc:SE|java/util/concurrent/atomic|AtomicInteger}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;long&amp;lt;/code&amp;gt;    || {{Javadoc:SE|java/util/concurrent/atomic|AtomicLong}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt; || {{Javadoc:SE|java/util/concurrent/atomic|AtomicBoolean}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;V&amp;lt;/code&amp;gt;       || {{Javadoc:SE|class=AtomicReference&amp;lt;V&amp;gt;|java/util/concurrent/atomic|AtomicReference}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;AtomicInteger&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;AtomicLong&amp;lt;/code&amp;gt; classes are subclasses of the &amp;lt;code&amp;gt;Number&amp;lt;/code&amp;gt; class.  The &amp;lt;code&amp;gt;AtomicReference&amp;lt;/code&amp;gt; class accepts the [[TypeParameter|type parameter]] &amp;lt;code&amp;gt;V&amp;lt;/code&amp;gt; that specifies the type of the object [[reference (computer science)|reference]]. (See &amp;quot;[[Generics in Java]]&amp;quot; for a description of type parameters in Java).&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Java Platform, Standard Edition#java.lang|java.lang]]&lt;br /&gt;
* [[Java Platform, Standard Edition#java.lang.reflect|java.lang.reflect]]&lt;br /&gt;
* [[Java (programming language)|Java programming language]]&lt;br /&gt;
* [[Java syntax]]&lt;br /&gt;
* [[Java compiler]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--Categories--&amp;gt;&lt;br /&gt;
[[Category:Java (programming language)]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Panamitsu</name></author>
	</entry>
</feed>