0% found this document useful (0 votes)
55 views7 pages

3.2 Primitive Data Types Detailed

The document discusses Java data types and classifies them into primitive and non-primitive types. It provides details on the 8 primitive types including their default values and sizes in bytes. Non-primitive types are reference types that refer to objects and are created by the programmer, unlike primitive types which are predefined. Key differences between primitive and non-primitive types are outlined such as non-primitives allowing method calls and the ability to be null. Examples of non-primitive types include Strings, Arrays, and Classes.

Uploaded by

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

3.2 Primitive Data Types Detailed

The document discusses Java data types and classifies them into primitive and non-primitive types. It provides details on the 8 primitive types including their default values and sizes in bytes. Non-primitive types are reference types that refer to objects and are created by the programmer, unlike primitive types which are predefined. Key differences between primitive and non-primitive types are outlined such as non-primitives allowing method calls and the ability to be null. Examples of non-primitive types include Strings, Arrays, and Classes.

Uploaded by

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

Concept Revisiation

Java datatypes:

1. How are they classified into?


2. How are primitive datatypes classified?
3. How many types of primitive data types?
4. What are non-primitive / complex/ reference/ derived data types?
Data Type Default Value (for fields)

byte 0
short 0
int 0
long 0L
float 0.0f
double 0.0d
char '\u0000'
String (or any object) null

boolean false
Non-Primitive Data Types

Non-primitive data types are called reference types because they refer to objects.

The main difference between primitive and non-primitive data types are:

● Primitive types are predefined (already defined) in Java. Non-primitive types are created by
the programmer and is not defined by Java (except for String).
● Non-primitive types can be used to call methods to perform certain operations, while primitive
types cannot.
● A primitive type has always a value, while non-primitive types can be null.
● A primitive type starts with a lowercase letter, while non-primitive types starts with an
uppercase letter.
● The size of a primitive type depends on the data type, while non-primitive types have all the
same size.

Examples of non-primitive types are Strings, Arrays, Classes, Interface, etc.


Lets watch a video
Data Types

Resources:
Document to Primitive data types

Document to data types:Non- primitive


Exit Ticket:
Reflect and Engage.
Types of Primitive Data types with their bytes value.
Types of Non- Primitive data types
Do -Now: 10 mins
Find the Hierarchy of the data types.

You might also like