Byte_KeyWord 悠悠 2021-11-05 06:38 139阅读 0赞 ## byte Keyword in Java with Examples ## A byte is a Java primitive type. This is a signed 8-bit type that has a range from –128 to 127. Variables of type byte are especially useful when you’re working with a stream of data from a network or file. There is Byte wrapper class represents primitive byte as an object. ### byte Java Keyword Examples ### Byte variables are declared by use of the byte keyword. For example, the following declares a byte variable called a: byte a = 1; The byte keyword can be used to the declared return type of a method as well: public byte getByte() { return a; } ### Summary ### * A byte variable is signed 8-bit type that has a range from –128 to 127. * The Byte class is a wrapper class for the byte primitive type. It defines MIN\_VALUE and MAX\_VALUE constants representing the range of values for this type.
还没有评论,来说两句吧...