0% found this document useful (0 votes)
6 views2 pages

Primitive Data Types

The document outlines the different types of data in programming, categorizing them into primitive data types (integral, floating-point, and others) and reference data types (class, interface, array, and enumeration). It highlights key differences between these types, including size, default values, storage methods, operations, and how they are passed in functions. Overall, it provides a concise overview of fundamental data types and their characteristics.

Uploaded by

bhikanarharish14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Primitive Data Types

The document outlines the different types of data in programming, categorizing them into primitive data types (integral, floating-point, and others) and reference data types (class, interface, array, and enumeration). It highlights key differences between these types, including size, default values, storage methods, operations, and how they are passed in functions. Overall, it provides a concise overview of fundamental data types and their characteristics.

Uploaded by

bhikanarharish14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Primitive Data Types:

1. Integral Types:
 byte: 8-bit signed integer
 short: 16-bit signed integer
 int: 32-bit signed integer
 long: 64-bit signed integer
2. Floating-Point Types:
 float: 32-bit floating-point
 double: 64-bit floating-point
3. Other Primitive Types:
 char: 16-bit Unicode character
 boolean: Represents true or false

Reference Data Types (Non-Primitive):


1. Class Types:
 Any user-defined class, including classes you create.
2. Interface Types:
 Any interface defined by Java or user-defined interfaces.
3. Array Types:
 Arrays of any data type, including arrays of primitive or reference
types.
4. Enumeration Types:
 A special data type for defining collections of constants.

Differences:
1. Size and Precision:
 Primitive types have a fixed size.
 Reference types vary in size based on their class definitions.
2. Default Values:
 Primitive types have default values (e.g., 0 for numeric types, false
for boolean).
 Reference types have a default value of null.
3. Storage:
 Primitive types store actual values.
 Reference types store references (memory addresses) to objects.
4. Operations:
 Primitive types support basic operations directly.
 Reference types involve more complex operations defined by the
class.
5. Pass by Value vs. Pass by Reference:
 Primitive types are passed by value.
 Reference types are passed by value, but the value is the reference
(memory address).
Contents
Primitive Data Types:.......................................................................................................1
Reference Data Types (Non-Primitive):.................................................................1
Differences:............................................................................................................................1

You might also like