Page 35 - CA_Blue( J )_Class10
P. 35

03


                                                                  VALUES AND DATA TYPES
















                           Learning Objectives



                     3.1 Character Sets in Java                       3.2 How Characters are Stored in Memory?
                     3.3 Escape Sequences                             3.4 Tokens
                     3.5 Data Types                                   3.6 Variables and Constants
                     3.7 Declaration vs Initialization                3.8 Type Conversion




                 A program is a collection of instructions. These instructions are written using a programming language. Before writing
                 a program, we need to understand the fundamental concepts of the programming language.
                 In this chapter, we will learn about different fundamental concepts of a Java programming language.


                     3.1 CHARACTER SETS IN JAVA
                 A  character  set  is  a  set  of  letters,  digits  and  special  characters  that  a  programming  language  can  support.  Every
                 programming language has its own character set. Similarly, Java also has its own character set. Java character set
                 includes the following:
                 •  Letters: All the letters of the English language (A–Z) or (a–z).
                 •  Digits: Digits from 0 to 9 can be used in Java programming.
                 •  Special Characters: These are the symbols or signs used to specify a function to be performed in Java programming.
                   For example, +, &&, <=, ++, ( ), { }, [ ], comma(,), dot(.), semicolon(;), question mark(?), colon(:), etc.


                     3.2 HOW CHARACTERS ARE STORED IN MEMORY?
                 A computer is a man-made machine. It isn't capable of recognising anything from the 'human world' directly as it
                 understands numeric values (binary values). To store character values, corresponding numeric values in binary form
                 are generated. Thus, the characters entered have to be encoded into their numeric form. There are mainly two types
                 of encoding techniques which are ASCII code and Unicode. Let us learn about them.

                 3.2.1 ASCII Code
                 ASCII stands for American Standard Code for Information Interchange. It is a character encoding standard for text files in
                 computers and other devices. It is made up of 128 symbols consisting of letters (both uppercase and lowercase), numbers,
                 punctuation marks, special characters and control characters. It uses 7-bit numeric codes to represent characters. For
                 example, the ASCII value of character 'A' is 65 and the 7-bit code is 1000001. The numeric range of ASCII codes is from
                 0 to 127. It was designed to represent only basic English characters.


                                                                                                                       33
                                                                                                 Values and Data Types  33
   30   31   32   33   34   35   36   37   38   39   40