World Languages, asked by shreyashbharpoda, 1 year ago

Write a program in java of conversion device.

Answers

Answered by DreamySoul
1

class Test

{

public static void main(String[] args)

{

int i = 100;

//automatic type conversion

long l = i;

//automatic type conversion

float f = l;

System.out.println("Int value "+i);

System.out.println("Long value "+l);

System.out.println("Float value "+f);

}

}

Output:

Int value 100

Long value 100

Float value 100.0

Answered by Anonymous
0

Explanation:

Type conversion in Java with Examples. When you assign value of one data type to another, the two types might not be compatible with each other. ... For example, assigning an int value to a long variable. Widening or Automatic Type Conversion. Widening conversion takes place when two data types are automatically converted.

Similar questions