Java Reference
In-Depth Information
Variables
It is basic unit of storage and variables have scope, visibility and lifetime.
Declaration of variables
Int x, y, z;
Or
Int x=1, y=2, z=5;
Type conversion and casting
If there is any compatibility existing between two types then java would automatically per-
forms the conversion.
Java automatic conversion
It will be performed when two conditions are met.
When the two types are compatible;
Destination type is larger than the source type.
After the two conditions are been satisfied a widening conversion takes place.
Casting compatible types
It is a simple and explicit type of conversion.
When a floating type of conversion is attached to an integer type this type of
conversion is called truncation.
It is a kind of conversion sometime called narrowing conversion.
Search WWH ::




Custom Search