Continuing Java Basics - Operators
New Terminology
- type casting
- process of explicitly converting a value from one type to
another (does not change a variable's declaration)
- widening conversion
- process of changing a value from a smaller type to a larger
type to match a corresponding operand (automatic in java)
- narrowing conversion
- process of changing a value from a larger type to a smaller
type to match a corresponding operand (must be explicitly cast)
- remainder operator / integer division
- integer division in java results in whole numbers only. The
remainder operator is used to calculate the remainder after division.
- combined operations
- DO NOT USE THIS TERM
- operator precedance
- The order in which operations are carried out.
Programming specific structures and terms
- declaration statement
- Associates a data type and container type with an
identifier.
- variable declaration
- A declaration statement for variables. Form: datatype
identifier;
- constant declaration
- A declaration statement for contants. Form: final datatype
identifier;
- assignment statement
- A statement which causes a value to be stored in a
variable. Form: variable =
expression;
- operator
- A symbol for an operation, such as +, -, *, /, and %
- operand
- One datum on which an operator works
- binary operator
- A binary operator has two operands
- unary operator
- A unary operator has one operand
- java complex data type
- String - text data
Class notes
- Learning Style brief explanation
- Review lab Lab05.java - How did you solve the problem of assigning 4.6 to a float
variable.
- data type
- java primitive data type - See Table 2-5 (pg 45)
- Integers - int, byte, short,
long
- Floating point - float, double
- Characters - char
- True/False - boolean
- identifier names - see examples Table 2-4 (pg 43)
- constants vs variables
- for this class, all declarations must appear at the beginning of the program
- Operations - * / % + -
- data type, operand result
- integer division
- order of operations - what is done first, next (pg - 58)
- parenthetical expressions
- Widening conversion - Narrowing conversion
- Automatic widening
- type casting
- order of casting
- ramification of using casting when it is better to use
the correct types
- Powers of two review of homework. Play.java
- Other examples Letters2.java, Sale.java