Primitive wrapper class in Java: Difference between revisions

Content deleted Content added
Wrapper classes aren't specifically restrained only to Java
Line 29:
==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.