Showing posts from August, 2020

Java Conversion Types and Conversion Contexts

When an expression evaluated in Java programing language it either produce a result or nothing. An expression denotes nothing if and only if it is a method invocation. An expression produce a result has a type that can be deduced at compile time from the structure of the expression, the types of the literals, variables, and methods mentioned in the expression. The expression that produce a result will always evaluated in some context and it must be compatible with a type expected in that context; this type is called the target type. The compatibility of expression with it's surrounding context type is determined as  The expression the deduced type can be influenced by the target type After the type of the expression has been deduced, an implicit conversion from the type of the expression to the target type can be performed If neither of the above strategy is able to produce the appropriate type, a compile-time error occurs. In some cases context is able to accept a expression type