Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
As every data type has its default value after initialization so I would like to know the default value for byte data type in Java.
Byte data type is an8-bit signed two's complement integer.
Minimum value is -128 (-2^7)
Maximum value is127 (inclusive)(2^7 -1)
Default value is0
Byte data type is used to save space in large arrays, mainly in place of integers, since a byte is four times smaller than an int.
Example: byte a =100 , byte b = -50
Default value of byte data type in java is "0"
Default value is "0" for byte data type
There are two types of data type in java or in OO world which is primitive and objects the difference is primitive data types store in stack, and object are stored in memories so byte x; when you declare since it’s a primitive data type it’s store in stack, so it’s basically x is a pointer to the stack which is empty when you try to run exception will pop up but when you think technically it’s x point to empty space in the stack it’s the same us objects
0 is default value for all integer data types i.e. byte, short, int long
Its0