CISC 124 Lecture 4: Java Expressions
Document Summary
Binary arithmetic operators: +, -, *, /, % Java doesn"t have an exponentiation operator - use math. pow(x, y) Integer arithmetic: truncated answer, fractional parts are discarded. If one of them is not a string, it will convert it. Unary operators: operate on a single value (+ and -) Includes ++ and -- to increment or decrement a val by 1. Basic comparisons: ==, !=, >, =, <= Not: ! (reverses logic of whatever symbol it"s next to) Single will evaluate both sides of the expression. Double will only evaluate 1 side and stop. && stops if the left side is false. || stops if the left side is true. If the method is the same as the class, use the same name. If not, identify the object owning the method and obtain the method using the dot operator. If it is static, invoke the method without instantiating the class.