Java Basics And Java Alphabet

Page content

Java - the basics

In this article, we discuss some basic concepts you need to know in order to write programs in the Java programming language.

A programming language is similar to a spoken language in many respects. It has an alphabet (more commonly referred to as a character set) from which everything in the language is constructed. It has rules for forming words (also called tokens), rules for forming statements and rules for forming programs.

These are called the syntax rules of the language and must be obeyed when writing programs. If you violate a rule, your program will contain a syntax error. When you attempt to compile the program, the compiler will inform you of the error. You must correct it and try again.

The first step in becoming a good programmer is learning the syntax rules of the programming language. This is the easy part and many people mistakenly believe that this makes them a programmer. It is like saying that learning some rules of English grammar and being able to write some correctly formed sentences make one a novelist.

Novel-writing skills require much more than learning some rules of grammar. Among other things, it requires insight, creativity and a knack for using the right words in a given situation.

In the same vein, a good programmer must be able to creatively use the features of the language to solve a wide variety of problems in an elegant and efficient manner. This is the difficult part and can only be achieved by long, hard study of problem-solving algorithms and developing experience by writing programs to solve a wide range of problems. But we must start with baby steps.

The Java alphabet

We can think of the Java alphabet as consisting of all the characters one could type on a standard English keyboard, for example, the digits, uppercase and lowercase letters, and special characters such as +, =, <, >, & and %.

More formally, Java uses the ASCII (American Standard Code for Information Interchange, pronounced ass-key) character set . This is a character standard which includes the letters, digits and special characters found on a standard keyboard. It also includes control characters such as backspace, tab, line feed, form feed and carriage return. Each character is assigned a numeric code. The ASCII codes run from 0 to 127

The programs in this series will be written using the ASCII character set which, can be viewed here.

Technical note: In reality, Java uses the Unicode character set. For starters, it includes the ASCII character set. But Unicode also includes all characters in most written languages in the world. In order to represent so many characters Unicode uses two bytes (16 bits) for storing each character. With 16 bits, one can store 2^16 = 65,536 different codes. Unicode is especially useful if one is writing a program for use by people speaking different languages. In this series, we use only the English alphabet.

In the next article, we will take a look at Java tokens.


Reference text: Java Programming – A Beginner’s Course

Related programming references

This post is part of the series: Introduction to Java Programming

This is a series which aims to discuss and teach Java programming to the complete beginner. Absolutely no programming background is assumed.

  1. Introduction to Java Programming - An Overview
  2. Java - Data, Variable and Algorithm Explained To A Beginner
  3. Java Example: Algorithm and Program For Area of Square
  4. Java Programming For Beginners - Test, Debug, Document, Maintain
  5. JDK Java Compiler: The Java Development Kit
  6. Java Programming For Beginners - How To Compile And Run Java Programs
  7. Data Types, Constants And Variables
  8. Java Programming For Beginners - Characters and printf
  9. Java Programming For Beginners - Part 9
  10. Java Programming For Beginners - Part 10
  11. Java Programming For Beginners - Part 11
  12. Java Programming For Beginners - Part 12
  13. Java Programming For Beginners - Part 13
  14. Java Programming For Beginners - Part 14
  15. Java Programming For Beginners - Integer Data Types
  16. Java Programming for Beginners - Part 16
  17. Java Integer Arithmetic For Beginners
  18. Java Programming For Beginners - Part 18
  19. Java Programming For Beginners - Part 19
  20. Java double to int and Other Conversions