COMP SCI 302 Lecture 2: Lectures 1 and 2
Document Summary
3 is an expression because it evaluates to a single value. 3. 0 + 1 = 4. 0 (a double + an int = a double) Math function expressions (method that returns a value) Math. sin() *needs to be radians *tallest # to stop at math. ceil() Math. cos() *needs to be radians *smallest # to stop at math. floor() Examples: double prac = math. pow(18. 45,4); double prac1 = math. sqrt(6. 34); *also, there are keywords in java that are not allowed to be used as variable names, including: int, double, final. Editor: type code in file and save (similar to word processor) Run: bytecode is then interpreted by java virtual. Edit - compile - run double (64 bit, 2 ^ 64), int (32 bit, cannot store decimals, truncates at ones place) Any name, but has to start with a lowercase letter an amount you assign the variable (-1,0,1,null) *use descriptive variable names (at most 10 characters)