You are on page 1of 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