Data Types in Java

What is data types ?
Data type are used to represent types of the variable and expressions
Data types are used to representing how much memory is allocated for  variable
Data type are use to specifies the range value of variable 

Data types in java
Syntax of Data Types
The basic syntax of data type are as follows,

Data types   name of variable = value /literal;

Eg.  int a=10;

int  ->   Data Type
a    ->   Variable name
=    ->  Assignment
10  ->   Constant Value
;    ->   Statement terminator 

Types of data types
Data types are divided into two sub part
  • primitive data type
  • Non - Primitive data type
Primitive data type in java
In Java primitive data type are used to  specifies the size and type of variable of value
There are 8 Primitive data types in java –
  • Byte
  • Short
  • Int
  • Long
  • Float
  • Double
  • Char
  • boolean
Primitive data types in java
Non-Primitive data type in java
In java a Non-primitive data types are also known as  reference types because Non-primitive data types refer to objects.

Examples of non-primitive data types
  • Strings
  •  Arrays
  • Classes, 
  • Interface    etc.
Important point to remember about Non- primitive data type
  • In java a non primitive data type are not pre-define it is created by the java programmer except string data type
  • In java programmer used non primitive data type to call method  to perform some creation action.
  • In java a non –primitive data type can be null.
  • In java a non primitive data type start with Upper Case

Brief Explanation of Data Types-
Byte  Data Type

Short Data Type

Int Data Type

Long Data Type

Float Data Type

Double Data Type

Char Data Type

Boolean Data Type

Hope !!! The above tutorial of data types in java helpful for you..

Team ,
QA acharya

Tags : Data types in java , java data types , types of data types , non primitive data types , primitive data types , types of primitive data types , 

Post a Comment