Difference Between Class and Primitive Types: Students 3K
Difference Between Class and Primitive Types: Students 3K
HOME
STUDENTS+
FRESHERS
STUDY RESOURCES
MORE >>
You are here: Home / Interview / Difference Between Class and Primitive Types
result will declared that the two integers are equal. If two strings namely USA and USA are compared using
equality operator the result will state that the strings are not same.
When primitive values are passed into a method, its values are copied. When class values are passed into
method only the handle of class types are copied.
HOME is returned
STUDENTS+
FRESHERS
STUDY RESOURCES
MORE >>
Primitive type returns its value while only the handle
in the case
of class type.
Primitive types are stored in stack while class type are stored as heap which is managed by garbage collector.
The memory space consumed by primitive data types is very less when compared to the memory type of class
type. Class type consumes more memory because it maintains metadata objects.
Primitive data types can be copied but class data types can be shared.
All primitive data types have an default value but uninitialized class data types will throw
NullPointerException.
STUDENTS 3K
Autoboxing is used to convert the primitive type into class type while unboxing is used to convert class type into
primitive type. If a statement is written in primitive or class type, it is converted vice versa according to the
requirement of the compiler. Conversion using Autoboxing and unboxing works only if the type has a value. If
objects which are called using constructors are converted, it will result in a compiler error.
STUDENTS 3K
HOME
STUDENTS+
FRESHERS
STUDY RESOURCES
MORE >>
Generate
PDFs In Java
Highly Ef cient Java PDF
Library. Download Fully
Functional Eval!
dynamicpdf.com
C PROGRAMMING GUIDE...
RANDOM MATERIALS :
Data Mining and Data Warehousing
Difference Between Class and
Primitive Types
Database Roles in SQL
CASE Expression in SQL
Concurrent Update Problem
Adsby Google
STUDENTS 3K
JavaIntegerClass
Class10
HOME
STUDENTS+
FRESHERS
STUDY RESOURCES
MORE >>
FOLLOW US ON FACEBOOK
Adsby Google
DataClassC#
ClassBoxing
ADVERTISEMENT
Adsby Google
STUDENTS 3K
UsedClassA
ProgramJava
HOME
STUDENTS+
FRESHERS
COMPANY PROFILE
CATEGORIES
About Students3k
Important Programs
Contact Us
Study Abroad
IT Companies
Privacy Policy
Teachers
Disclaimer
Verbal Analogies
STUDY RESOURCES
WE ARE SOCIAL
Facebook Fans
Twitter Follow
Google Plus
Pinterest Page
MORE >>