简体   繁体   English

java中的字节数据类型是什么以及为什么使用它?

[英]What is byte data type in java and Why it is used?

I am little bit confused in a data type of java named byte data type and why they are used?我对名为 byte 数据类型的 java 数据类型感到有些困惑,为什么要使用它们?

I don't have any idea about byte data type.我对字节数据类型一无所知。 Can anybody help me in resolving my problem ?有人能帮我解决我的问题吗?

byte: The byte data type is an 8-bit signed two's complement integer. byte:字节数据类型是一个 8 位有符号二进制补码整数。 It has a minimum value of -128 and a maximum value of 127 (inclusive).它的最小值为 -128,最大值为 127(含)。 The byte data type can be useful for saving memory in large arrays, where the memory savings actually matters.字节数据类型可用于在大型数组中节省内存,其中内存节省实际上很重要。 They can also be used in place of int where their limits help to clarify your code;它们也可以代替 int 使用它们的限制有助于澄清您的代码; the fact that a variable's range is limited can serve as a form of documentation.变量范围有限的事实可以作为一种文档形式。

via: Java Docs通过: Java文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM