CLASS - X (ICSE)
COMPUTER APPLICATION
Character
Sets
®
Set
of valid characters that a language can recognize.
®
Letters:
A-Z , a-z
®
Digits:
0-9
®
Special Symbols: Space + - * / ^ \ ( ) [ ] { } =
!= <> . „ “ $ , ; : % ! & ? _ # <= >= @
®
White Spaces:
Blank spaces, horizontal tab, vertical tab
®
Other Characters : Any of the 256 ASCII
character or Unicode characters
Tokens
®
The
smallest individual unit in a program is known as token.
®
Tokens
used in java are: Keywords, Identifiers, Literals, Punctuators and Operators.
Identifiers:-
®
Identifiers
are programmer defined names given to the various program elements such as
variables, functions, arrays, objects, classes, etc.
®
It
may contain digits, letters and underscore
®
It
must begin with a letter or underscore or dollar($) but not a digit.
®
Java
is case sensitive.
®
Examples of legal identifiers: age, $salary, _value, __1_value.
®
Examples of illegal identifiers: 123abc, -salary.
Literals
or Constants:-
®
The
data items which never change their value throughout the program run.
®
There
are several kinds of literals:
·
Integer
literals
·
Character
literals
·
Floating or Real literals
·
String
literals
·
Boolean
literals
·
Null
literal
1. Integer
literals:
®
Integer
literals are whole numbers without any fractional part.
®
An
integer literal must have at least one digit and must not contain any decimal
point.
®
It
may contain either + or - sign. A number with no sign is assumed as positive.
®
There
are three types of integer literals
F
Decimal (base 10):- starts with a digits other than
0. E.g. 24
F
Octal (base 8):- starts with a digit 0 but can’t
contain digits 8,9. E.g. 030
F
Hexadecimal (base 16):- starts with a 0X or 0x but can’t
contain letter G-Z. E.g. 0x18
2.
Character literals:
®
Any
single character enclosed within single quotes is a character literal.
®
e.g ‘ A’
, ‘3’
3.
Floating or Real literals:
®
Numbers
which are having the fractional part are referred as floating literals or real
literals.
®
It
may be a positive or negative number.
®
A
number with no sign is assumed to be a positive number.
®
e.g 2.0, 17.5, -0.00256
®
A
real literal in exponent form consists of two parts: mantissa and exponent
®
E.g 0.147 x 108 = 0.147E08
®
Part
appearing before E is mantissa and after E is exponent.
4.
String Literals:
®
It
is a sequence of character surrounded by double quotes.
®
e.g., “abc” , “23”.
5.
Boolean Literal:
®
It
is true or false.
6.
Null Literal:
®
It
is represented as ‘\0’.
®
It
is applied as a string terminator to mark the end of a string.
Keywords:-
®
Keywords
are reserved words that convey special meaning to the compiler.
Eg:- while, do, for, if, else, public, void, switch, break, continue etc.
Punctuators:-
®
[
] Brackets These indicates single and
multidimensional array subscripts
®
() Parenthesis These indicate function calls and function
parameters.
®
{
} Braces Indicate the start and end of
compound statements.
®
; Semicolon This is a statement terminator.
®
, Comma It is used as a separator.
®
: Colon It indicates a labeled statement
®
= Equal to It is used as an assigning operator.
Operators:-
®
An
operator is a symbol or character which trigger some operation (computation) on
its operands.
®
Types
of operators:-
1.
Arithmetic
Operators
2.
Relational
Operators
3.
Assignment
Operators
4.
Logical
Operators
5.
Conditional
Operators
6.
Bitwise
Operators
No comments:
Post a Comment