Why does a byte can represent a character?

by Dinesh Thakur Category: Data Type

A computer cannot store characters or integers. Computer can store information in the form of bits and bytes. The bit is a basic unit of information in computer. A bit can only have two values: `yes` or `no`, `true` or `false`, `1` or `0.`

To Representing Data in computer, we using Bits, we need rules. We need to convert a string of bits (or pairing of a numeric code) into something like characters, numbers and pictures using an encoding scheme or character set, that defines how the string of bits are mapped to real-world letters Like this:

```        01001000 01100101 01101100 01101100 01101111```

```           H         e       l       l         o```

A certain pairing of a numeric code (or sequence of codes) stands for a character (letter) and a character stands for a certain sequence of bits (or sequence of codes).

The above encoding scheme happens to be ASCII or ISO-8859-1. A sequence of codes of`1`s and`0`s is broken down into parts of eight bits. The Below ASCII encoding scheme specifies a table translating bytes into human readable characters. Here's a short example of ASCII table:

 Bits Character `01000001` A `01000010` B `01000011` C `01000100` D `01000101` E `01000110` F

But you should always be using an encoding scheme or character set (like ASCII or ISO-8859-1) to convert bytes (or 8-bits) to letters and inversely, and there is no real agreement on what letter a byte (or 8-bits) might mapped to be.  And without knowing the mapping or encoding scheme, we can't sure what the bytes represent to.

In another words, we can say that, without an encoding scheme or character set (like ASCII or ISO-8859-1), bytes are just 8-bit integers. You can only guess what characters  or letters they represent, but it's just a guess.

Related Articles on Java Data Type

Dinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles