|
What will this program write to the monitor? A good answer might be:
New location:java.awt.Point[x=12,y=42] | ||||||||||||||||||||||||||||
Safe ConversionsIn general, if there is the possibility that information will be LOST, a converstion between one type and another will NOT be performed automatically. A conversion from a data type that uses N bits to a type that uses fewer than N bits always risks information loss, and will not be performed automatically. The compiler makes this decision by examining the data types involved, not the actual values involved. In the following situations, the compiler will automatically convert from the type of expression in a method call to the required type:
In the following situations, the compiler will not automatically perform the conversion.
Remember the sizes of the various primitive types (the primitive types char and boolean are not listed here):
| ||||||||||||||||||||||||||||
QUESTION 7:Click the button in the appropriate column for the following type conversions. There is only one correct column per row.
|