The byte Keyword

Ads
 

The byte Keyword

The byte Java Keyword defines the 8-bit integer primitive type.

The byte Java Keyword defines the 8-bit integer primitive type.

The byte Keyword

     

The byte Java Keyword defines the 8-bit integer primitive type. 

The keyword byte in Java is a primitive type that designates with eight bit signed integer  in java primitive type. In java keyword byte will be stored as an integer value between the range −128 to 127. 

The class ( java.lang.Byte) will be required as nominal wrapper class in that we need to store the byte value but  the object reference is needed. 

The byte class that is a wrapper class for byte primitive type and that also defines min and max values represent range of values for this type.

Syntact: Syntact of byte  Keyword

   byte <variable-name> = <integer-value>;


Here is an example:

public class Main {

public static void main(String[] args) {

byte sun= -12;
System.out.print("sun: ");
System.out.print(sun);

}


Ads

Ads