Skip to main content

ASCII Code in Java (Part 1)

>

The ASCII Code: (Part 1)

  • ASCII stands for "American Standard Code for Information Interchange".
  • As you may remember (Grade 9), computers only work with HIGH(1) and LOW(0) electrical states, known as bits, with correspond to mathematical Base 2 numbers. That is, computers only understand binary language.
  • ASCII codes represent text (or other things) in computers. Assume that you are working with MS Word, or PPT or any other tool that uses text based inputs from user. You need to type a sentence that computer is not aware of. ASCII codes help to exchange this information between user and computer. When you type a character, it is converted into ASCII code first and then into Binary, which makes the computer understand what is to be typed. Hence every key on the keyboard has a specific ASCII code which is used to make the computer understand our language.
  • If you press 4 from keyboard, then keyboard send the value 100 (value equivalent to 4). If you press key "a" the value will be 97 which is equivalent to 01100001.

The ASCII Codes

  • As Decimal is Base 10 (our) number system, we only have to check the decimal value of the specific character to get its ASCII code.
  • The Octal-HEX-Binary values are just given for Reference.
Click HERE for the Java program to print the ASCII Codes of different characters.
Click HERE for the Methods of Character class.

Comments

Post a Comment

Relevant to YOU:

Popular posts from this blog

Characteristics of Java OR Java Buzzwords (Part 1)

> Java Properties: The Java programming language is a high-level language that can be characterized by all the following buzzwords: Simple: Java is designed for easy and effective programming. If the concepts of object oriented programming are understood properly, the implementation of programs in Java becomes easy. Because Java inherits the syntax of C/C++ and many object-oriented features of C++, it is easy and simple to program. Object oriented: Java follows all the concepts of object oriented programming which includes three basic OOP features: Encapsulation: Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. Encapsulation is as a protective wrapper that prevents the code and data from being arbitrarily accessed by other code defined outside the wrapper. Access to the code and data inside the wrapper is tightly controlled through a well-defined interface or class.