Docsity

Java Data Types: Primitive and Non-Primitive Data Types, Study notes of Java Programming

Partial preview of the text

Download Java Data Types: Primitive and Non-Primitive Data Types and more Study notes Java Programming in PDF only on Docsity!

JAVA

DATA TYPES

Java Data Types

❖ Java programming language has a rich set of data types.

❖ The data type is a category of data stored in variables.

In java, data types are classified into two types and they are as follows. Primitive Data Types Non-primitive Data Types

1.Primitive Data Types

❖ The primitive data types are built-in data types and they specify the type of value stored in a variable and the memory size.

❖ The primitive data types do not have any additional methods.

❖ In java, primitive data types includes byte , short , int , long , float , double , char , and boolean.

Primitive Vs Non-primitive Data Types

Primitive Data Type Primitive Data Type These are built-in data types These are created by the users Does not support additional methods

Support additional methods

Always has a value It can be null Starts with lower-case letter Starts with upper-case letter Size depends on the data type Same size for all