Java Tutorials - Herong's Tutorial Examples - v8.20, by Dr. Herong Yang
What Are Bits and Bytes
This section describes bits and bytes as data storage units and as data types.
Bit - The smallest storage unit in the computer world. It can only hold two possible values: 0 and 1.
Bit - The smallest unit of measure of digital information size.
Bit - A single digit of a binary number. It can only have two possible values: 0 and 1.
Byte - A storage unit with 8 bits. A byte can hold 256 possible values.
Byte - A unit of measure of digital information size. 1 byte = 8 bits. For example, a Java source code file, Hello.java, has a size of 109 bytes.
Byte - A data type in many programming language. It can be used to store 256 possible integer values. In Java, 'byte' is a primitive data type that can store an integer value in the range of -128 and 127.
Table of Contents