Chapter 5. Conversions and Contexts

Every expression written in the Java programming language either produces no result (§15.1) or has a type that can be deduced at compile time (§15.3). When an expression appears in most contexts, it must be compatible with a type expected in that context; this type is called the target type. For convenience, compatibility of an expression with its surrounding context is facilitated in two ways:

• First, for some expressions, termed poly expressions15.2), the deduced type can be influenced by the target type. The same expression can have different types in different contexts.

• Second, after the type of the expression has been deduced, an implicit conversion from the type of the expression to the target type ...

Get The Java® Language Specification, Java SE 8 Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.