Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ajmer Singh PGT(IP) Programming Fundamentals. Ajmer Singh PGT(IP) Java Character Set Character set is a set of valid characters that a language can recognize.

Similar presentations


Presentation on theme: "Ajmer Singh PGT(IP) Programming Fundamentals. Ajmer Singh PGT(IP) Java Character Set Character set is a set of valid characters that a language can recognize."— Presentation transcript:

1 Ajmer Singh PGT(IP) Programming Fundamentals

2 Ajmer Singh PGT(IP) Java Character Set Character set is a set of valid characters that a language can recognize. A character represents any letter, digit, or any other sign. Java uses the Unicode character set. Letters :- A-Z, a-z Digits :- 0-9 Special Symbols :- Space + - * / ^ \ ( ) [ ] { } = !=. ‘ “ $, ; : % ! & ? _(underscore) # = @ White Spaces :- Blank spaces, Horizontal tab, Carriage return, New line, Form feed.

3 Tokens(Lexical units) The smallest individual unit in a program is known as a Token or lexical unit. Types of Tokens :- Keywords Identifiers Literals Punctuators Operators

4 Keywords Keywords are the words that convey a special meaning to the language compiler. These are reserved for special purpose and must not be used as normal identifier names. E.g if, else, int, float, etc.

5 Identifiers Identifiers are names given to different part of the program by user. Rules to write identifiers :- 1. They must not begin with digits. 2. No special symbols are used except _(underscore) and $ (dollar sign) character 3. They must not be a keyword. 4. Java is case sensitive language. Upper case and lower case letters are treated differently. Examples:- myfile, date9_2_7_6

6 Literals Literals (literals) are data items that are fixed data values. Types of Literals :- 1. Integer literal 2. Floating literal 3. Character literal 4. String literal 5. Boolean literal 6. Null literal

7 Integer Literal Integer literals are whole numbers without any fractional part. Three types of Integer literals :- 1. Decimal Integer literal 2. Octal Integer literal 3. Hexadecimal Integer literal

8 Decimal Integer literal An integer literal consisting of a sequence of digits is taken to be decimal integer literal unless it begins with 0 (digit zero). Example:- 1296, 5642, 12, +69,- 23,etc.,

9 Octal Integer literal A sequence of digits starting with 0(digit zero) is taken to be an octal integer. Example:-0123, 0456, etc.,

10 Hexadecimal Integer literal A sequence of digits preceded by 0x or 0X is taken to be an hexadecimal integer. Example:- 0x4B6, 0XA43,etc.,

11 Floating literals Floating literals are also called as Real literals Real literals are numbers having fractional parts. These may be written in one of the two forms called fractional form or the exponent form. Examples:-2.0, 3.5, 8.6, etc.,

12 Character literals A Character literal is one character enclosed in single quotes, as in ‘z’. Examples:- ‘a’, ‘b’, etc.,

13 String Literals String literal is a sequence of zero or more characters surrounded by double quotes(“ ”). Examples:-”a”, “ade”, etc.,

14 Ajmer Singh PGT(IP) Punctuators or Separators The following characters are used as punctuators. [ ] ( ) { }, ;.

15 Ajmer Singh PGT(IP) Operators Operators are symbols that perform some action. E.g +, -, /, * etc.


Download ppt "Ajmer Singh PGT(IP) Programming Fundamentals. Ajmer Singh PGT(IP) Java Character Set Character set is a set of valid characters that a language can recognize."

Similar presentations


Ads by Google