Variables in Java

Variable is an arbitrary name used to refer to the area of memory in which a value for a particular data type is stored.
Declaration of Variable
datatype variable1 , variable2
Note: Initializers are optional

Example:
int x, y, z;
char a1, b1, c1;
float f1, f2, f2;

Example for initializing variables:
Syntax:
variable = constant;
Example:
int ivar = 100;
float ifloat = 100.25;

Datatypes in Java

Java has wide variety of data types and size and format of all data types are same irrespective of operating system. In addition to it all numeric variables in java are signed. Java prevents type casting between arbitrary variables. Only casts between numeric variables and between classes of the same object are allowed. Thus making java a strongly typed language.

Integer Data Types
[table width=”250px”]
DataTypes,Size,Range
byte,1,-128 to 127
short,2,-32768 to 32768
int,4,-2147483648 to 2147483647
long,8,-9223372036854775808 to 9223372036854775807
[/table]

Floating-Point Data Types
[table width=”250px”]
DataTypes,Size,Range
float,4,3.4e-038 to 3.4e+038
double,8,1.7e-308 to 1.7e+308
[/table]

Character Data Types
[table width=”250px”]
DataTypes,Size,Range
Char,2,0 to 65523
[/table]

Boolean Data Type
The Boolean data types is used to represent logical value. The variables declared as Boolean can store only true or false value.

Level 1: Keywords in Java

Keywords also called as reserved words. Which intern means it’s already defined in Java compiler. Thus cannot be used as normal identifiers. All keywords much be written in lower case.
Below are Java Keywords

[table width=”250px”]
abstract,double,instanceof,strictfp
boolean,else,int,super
break,enum,long,switch
byte,extends,native,synchronized
case,final,new,this
catch,finally,package,throw
char,float,private,throws
clase,for,protected,transient
const,goto,public,try
continue,if,return,void
default,implements,short,volatile
do,import,static,while
[/table]