0% found this document useful (0 votes)
2 views

Lectuare-4.1

Type conversion is the process of converting one predefined data type into another, which can occur through implicit or explicit methods. Implicit conversion automatically converts smaller data types to larger ones, while explicit conversion requires programmer intervention to convert larger types to smaller ones. A type conversion table illustrates the compatibility between different data types.

Uploaded by

Neeraj Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lectuare-4.1

Type conversion is the process of converting one predefined data type into another, which can occur through implicit or explicit methods. Implicit conversion automatically converts smaller data types to larger ones, while explicit conversion requires programmer intervention to convert larger types to smaller ones. A type conversion table illustrates the compatibility between different data types.

Uploaded by

Neeraj Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Type Conversion:

The process of converting one predefined type


into another is called Type Conversion.
It can be possible in two ways:
(i) Implicit type conversion:
It is the way that convert smaller primitive
data type convert into larger or same size data
type. It done automatically or by programmer.
byte > short > int > long > float > double
Note:
char can be convert into int, long, float, and
double.
(i) Explicit type conversion:
It is the way that convert larger primitive
data type convert into smaller size data type.
It done by programmer.
Syntax:
(type) expression or variable;
Example:
double d=5.25;
int a=(int) d;

byte < short < int < long < float < double
Type Conversion Table :
int long float doubl char byte short boolea
e n
int - A A A C C C N

long C - A A C C C N

float C* - N

double - N

char - N

byte - N

short - N

boolea N N N N N N N -
n

You might also like