A non-boolean primitive data type can be converted to another non-boolean type
if the conversion is a widening conversion.
A non-boolean primitive data type cannot be converted to another non-boolean type
if the conversion would be a narrowing conversion.
public class MainClass{
public static void main(String[] argv){
double d;
short s;
d = 1.2345;
s = d; // Assign a double value to a short variable
}
}
|