☆What do you mean by type conversion?☆
Don't Spam
Answers
Type casting:-
It is the conversion of variables from one data type to another.
As we know that, variables must have a specific data type, therefore, sometimes it is important to convert one data type to another.
There are two types of Type Casting:-
1. Implicit type casting.
2. Explicit type casting.
1.Implicit Type casting.
It is an automatic type conversation from one data type to another.
Example:- (In Java)
int a=5;
double s=a;
Here, a is an integer data type.
When we assign the value of s to a, it is implicitly casted and hence the value of s will be 5.0 which is a double data type.
2. Explicit type casting.
It is the type conversion which occurs when one data type is forcibly converted/casted.
Example:-
double s=5.0;
int a = (int)s;
Here, int is written Between brackets to specify the data type into which it will be converted and then the variable to be converted is written.
Both are useful.
I hope you understood.
Answer:
Type conversion is converting one type of data to another type. It is also known as Type Casting. In C#, type casting has two forms − Implicit type conversion − These conversions are performed by C# in a type-safe manner.
Explanation:
please inbox me