CSC 111 Chapter Notes - Chapter 2: Boolean Expression, Operand, Bitwise Operation
Document Summary
If you need a placeholder to store number 1000000, you need an int. Thus, to save space, you want to use a primitive with the smallest possible data size. The primitives byte, short, int, and long can only hold integers or whole numbers, for numbers with decimal points you need either a float or a double: float = 32-bit, double = 64-bit. An operator performs an operation on one, two or three operands. Ex: x + 4 operands: x,4 operator: + Any legal combination of operators and operands are called an expression. expression. A boolean expression results in either true or false. And, the result of a floating-point expression is a floating point number. There are 6 categories of operators: unary operators, arithmetic operators, relational and conditional operators, shift and logical operators, assignment operators, other operators. Unary operators: unary operators operate on one operand.