Académique Documents
Professionnel Documents
Culture Documents
Language Basics
Keywords
Keywords of Java are given below –
abstract continue for new
switch
assert*** default goto* package
synchronized
boolean do if private
this
break double implements protected throw
byte else import public throws
case enum**** instanceof return transient
catch extends int short try
char final interface static void
class finally long strictfp** volatile
const* float native super while
• * not used
• ** added in 1.2
Identifiers
User defined names of variables,
constants, arrays, functions, classes
etc.
Identifiers can be defined using the
combination of
alphabets (a – z or A – Z)
numbers (0 – 9) and
underscore ( _ ).
Rules for naming Identifiers
Any keyword should not be used as an
identifier.
The name should consist of only
alphabets, numbers and underscore.
First character should be any alphabet or
underscore.
The name cannot start with a number.
Lowercase and uppercase characters are
considered as different in C++.
Basic data Types
In Java data types can be classified
under four major categories
depending upon the space required
for storing data in the memory.
Integers
Floating Point Numbers
Characters
Boolean
Integers
Integers are used to store whole
valued numbers.
All of these are signed, positive or
negative values.
Java does not support unsigned
integers.
Java defines four integer types – byte,
short, int and long.
Integers
+ Addition a+b
- Subtraction a–b
* Multiplication a*b
/ Division a/b
|| OR (a = = 5) || (b > a)
! NOT ! (a = = 5)
Expressions
Combination of operands and
operators
Arithmetic expression
a = b + 10;
Relational expression
a <= b
Logical expression