Skip to content

Latest commit

 

History

History

Casting

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

The final keyword placed in front of a variable is treated as a constant

When a datatype of type short is declared It will allocate 2 bytes of memory for the variable.

Then it will find a different memory location and try to allocate memory for the

another variable which we do not the name and this function is anonymous.

This process is called implicit casting it is also referred to as automatic conversion.

Whenever we have a value that can be converted to a bigger data type,

casting will take place implicitly or automatically. Therefore byte can be converted to short

and then a short can be automatically converted to an int. Then an int can easily be converted to a long

Casting a decimal(double) to an int is called explicit casting. Casting takes place only

with compatible types like we cannot cast a string to a number.