Search This Blog

If you have any problem or question please write in the comments. We will try to solve and send you the solution. Not just that we will also post your problems solution on our blog.

Saturday, 25 June 2011

What is type casting?

Type casting:
            If we want to store an integer value in a byte or short type variable. What we will do? When we need to store a large value in a small data type variable we use type casting. In type casting we explicitly make a value narrow so that it will fit into the targeted variable. 

General syntax:
                  Two incompatible/different data types can be converted into same. Its general syntax is
  • (target-type) value;
Here, target-type is the casting type, that data type in which your given value will be converted and value can be any variable or constant value.

Click here to see a program of type casting

No comments:

Post a Comment