Primitive wrapper class in Java: Difference between revisions

Content deleted Content added
Line 29:
==The Difference between Wrapper Classes and Primitive Types==
 
Primitive wrapper classes are not the same thing as are primitive types. TheWhereas mainvariables, differencefor is that whereas variablesexample, can be declared in Java as data types '''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 like variables that are assigned the 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.