Java 101: Evaluate Java expressions with operators
See the original posting on JavaWorld
Java applications process data by evaluating expressions, which are combinations of literals, method calls, variable names, and operators. Evaluating an expression typically produces a new value, which can be stored in a variable, used to make a decision, and so on.
In this tutorial, you will learn how to write expressions for your Java programs. In many cases you’ll use operators to write your Java expressions, and there are many types of operators to know how to use. I’ll briefly introduce Java’s operator types (including the additive, bitwise, logical, conditional, shift, and equality types) and their operands. You’ll also learn about important concepts such as operator overloading and operator precedence, and you’ll see a demonstration of primitive-type conversion. I’ll conclude with a small Java program that you can use to practice primitive-type conversions on your own.