0

Data Types in Java

java Programming

 

Java Programming Supports Following Eight Primitive Data Types :

Data type is generally used to represent what type of data is going to be stored in the memory location.In general we use to represent data either in number format or non number format. The data which is going to be represented may occupy some memory. In java every variable must be declared before using it in the program.

 

Byte :

 

This is used to store integer values.

In this we can store any number between -128 to +127.

It occupies one byte of memory (8 bits).

The limit is upto 127 because 127 is the largest number that can be represented in 1 byte memory.

Convert it into binary and if the number is positive then the sign bit value will be zero otherwise one.

Keyword = “byte” 

Short :

 

This is also used to store integer values but it has longer range as compared to byte.

The range is from -32768 to +32767.

It occupies 2 bytes of memory.

Keyword = “short” 

 

Int :

 

This is also used to store integer values.

This can accommodate values larger than short data type.

The range is from -2,147,483,648 to +2,147,483,647.

It occupies 4 bytes of memory.

Keyword = “int” 

 

 Long :

 

This is also used to store integers.

This can have values which can’t fit in int data type.

The range includes -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807.

It occupies 8 bytes of memory.

Keyword = “long”

 

Float:

 

This data type is used to store real numbers.

Numbers which are having fractional part in it.

It occupies 4 bytes of memory.

Keyword = “float” 

Double :

 

This is also used to store real numbers or floating numbers.

It’s range is always greater than float.

It occupies 8 bytes of memory.

Keyword = “double” 

Boolean:

 

This data type can have only two values either true or false.

Generally it represents one bit of information.

Keyword = “boolean” 

Char:

 

This data type is used to represent a single character.

Every key on the keyboard can be considered as a character.

It occupies two bytes of memory.

Keyword = “char” 



You Need "Data Types in Java" ???


"Data Types in Java" (Source Code / Report / PPT) Totally belong to CodingTalks Team and We always ready to Share our Stuff with our users. If you are Very Much Interested on This Topic Then you must Leave a Comment what Exactly you Looking For Or Send us Email to get Full Information.

Coding Talks
Team

Filed in: Java Tags: , , , , ,

Get Updates

Share This Post

Related Posts

Leave a Reply

Submit Comment

© 2017 CodingTalks. All rights reserved.

Warning: filemtime(): stat failed for /home/codingtalks/public_html/wp-content/plugins/floating-social-share-bar//js/waypoints.min.js in /home/codingtalks/public_html/wp-content/plugins/floating-social-share-bar/floatingshare.php on line 213