September 2011
Beginner
650 pages
15h 47m
English
Operators, variables, and literals are constituents of expressions. You probably already know the general form of an expression from your other programming experience, or from algebra. However, a few aspects of expressions will be discussed now.
Within an expression, it is possible to mix two or more different types of data as long as they are compatible with each other. For example, you can mix short and long within an expression because they are both numeric types. When different types of data are mixed within an expression, they are all converted to the same type. This is accomplished through the use of Java’s type promotion rules.
First, all char, byte, and short values are promoted to int. Then, ...
Read now
Unlock full access