Java View all facts Glossary Help |
mechanism > casting > casting a primitive type |
casting a primitive type | ||||
subject | fact |
casting a primitive type | cannot be used to convert a primitive type to an object | |
has example //i is an int | ||
has syntax (typename)value | ||
is a subtopic of Objects | ||
is a kind of casting | ||
may be done implicitly if the destination type is larger than the source type (such as using a byte as an int) | ||
may not involve a Boolean type | ||
must be done explicitly if the destination type is smaller than the source type to avoid loss of precision | ||
casting | has purpose to convert an instance of one data type into another which is a subclass of the original type |