Byte Data Type In Java


Byte Data Type ?

The smallest individual type is called Byte. This is singed 8 bits data type. It can be ranged from 128-127.


➦Byte data type is an 8bits signed two's complement integer.

➦Byte data type is used to save space in large arrays, mainly in place of integersm, since a byte is four times smaller than an int.

➦The byte data type is used to save memory in large arrays where the memory savings is most required. It saves space because a byte is 4 times smaller than an integer. It can also be used in place of "int" data type.

Syntax :
 byte Variable_Name = Value;
  

Example 1:



Output :

 10

Example 1:



Output :

10
4