Working With Variables:
A variable represents a memory location which holds data (values).
Declaring a Variable:
Syn:-
[access-spe] [modifier] datatype variablename;
[access-spe] [modifier] datatype variablename=value, variablename[=value,]...;
DataTypes
Integers:
byte 8bits -128 to 127
short 16bits -32,768 to 32,767
int 32bits -2,147,483,648 to 2,147,483,647
long 64bits -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Reals:
float 32bits 1.4* (10**-45) to 3.4* (10**+38)
(7 digits after decimal point)
double 64bits 4.9* (10**-324) to 1.8* (10**+308)
(15 digits)
Characters:
char 16bits 1char only
Booleans:
boolean 1bit true or false
Strings:
String
f-s datatype
%d byte short int long
%f float double
%c char
%s %S String
%b %B boolean
%h hex-dec
%o oct-dec
Priority (Precedence) Of Operators:
> 1st, the contents inside the braces: (), [] and . will be executed.
> Next unary -, ++, --, ~, !
> Next *, / and %
> + and - will execute next
> Bitwise operators >>, <<, >>>
> Relational operators >, >=, <, <=
> Relational operators ==, !=
> Bitwise operators &, ^, |
> Logical operators &&, ||
> Ternary ope ?:
> Assignment =, ope=
A variable represents a memory location which holds data (values).
Declaring a Variable:
Syn:-
[access-spe] [modifier] datatype variablename;
[access-spe] [modifier] datatype variablename=value, variablename[=value,]...;
DataTypes
Integers:
byte 8bits -128 to 127
short 16bits -32,768 to 32,767
int 32bits -2,147,483,648 to 2,147,483,647
long 64bits -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Reals:
float 32bits 1.4* (10**-45) to 3.4* (10**+38)
(7 digits after decimal point)
double 64bits 4.9* (10**-324) to 1.8* (10**+308)
(15 digits)
Characters:
char 16bits 1char only
Booleans:
boolean 1bit true or false
Strings:
String
f-s datatype
%d byte short int long
%f float double
%c char
%s %S String
%b %B boolean
%h hex-dec
%o oct-dec
Priority (Precedence) Of Operators:
> 1st, the contents inside the braces: (), [] and . will be executed.
> Next unary -, ++, --, ~, !
> Next *, / and %
> + and - will execute next
> Bitwise operators >>, <<, >>>
> Relational operators >, >=, <, <=
> Relational operators ==, !=
> Bitwise operators &, ^, |
> Logical operators &&, ||
> Ternary ope ?:
> Assignment =, ope=
No comments:
Post a Comment