Content deleted Content added
No edit summary |
Revision (3-14-2016) in accordance with Wikipedia encyclopedia formatting style and tone |
||
Line 1:
In object oriented programming and in the [[Java (programming language)|Java]] language in particular, a '''wrapper class''' is a class that [[Encapsulation (computer_programming) |encapsulates]] types, so that those types can be used to create object instances and methods in another class that need those types. So a '''primitive wrapper class''' is a wrapper class that encapsulates, hides or ''wraps'' data types from the eight primitive data types <ref>S. J., Chapman, ''Introduction to Java'', Prentice Hall, 1999.</ref>, so that these can be used to create instantiated objects with methods in another class or in other classes <ref>J. Murach, ''Murach's Java Programming'', 4th Edition, Mike Murach and Associates, Inc., 2011.</ref>, <ref>J. R., Hubbard, ''Programming with Java'', Schaum's Outline Series/McGraw Hill, 1998.</ref>. The primitive wrapper classes are found in the Java API.
Primitive wrapper classes are used to
The primitive wrapper classes and their corresponding primitive types are:
Line 28:
==The Difference between Wrapper Classes and Primitive Types==
Primitive wrapper classes are not the same thing as are primitive types. The main difference is that whereas variables can be declared in Java as '''double''', '''short''', '''int''', or '''char''', etc., data types, the eight primitive wrapper classes create instantiated objects and methods that inherit but hide the eight primitive data types, not variables that are assigned data type values <ref>J. Murach, ''Murach's Java Programming'', 4th Edition, Mike Murach and Associates, Inc., 2011.</ref>.
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.
|