COMP SCI 302 Chapter Notes - Chapter 1: Style Guide, Computer Programming, Escape Sequence
Document Summary
Assignment statement : assigns the right-side item"s current value into the variable on left side. Assigns the value 8 to the variable numapples. Expression: may be an integer, a variable, or simple calculation involving variable and integer using standard math operators such as: left . Common error among programmers is to assume = means equals like math. = means compute value on right and assign computed value into variable on. Common error: beginning programmers write assignment statement in reverse -- will compile but will be a bug. Numitems = 5; numitems = numitems + 1; Value of numitems becomes 6, overwriting the previous variable value. Identifier: name created by a programmer for an item (such as a variable or a method) Must be a sequence of letters (a-z, a-z, _, $) and digits (0-9) Most java programmers do not use $ or _ in their identifiers. Reserved word/ keyword: part of the java language (like int, short, double)