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

  1. Learning Style brief explanation
  2. Review lab Lab05.java - How did you solve the problem of assigning 4.6 to a float variable.
  3. data type
    1. java primitive data type - See Table 2-5 (pg 45)
      Integers - int, byte, short, long
      Floating point - float, double
      Characters - char
      True/False - boolean
  4. identifier names - see examples Table 2-4 (pg 43)
  5. constants vs variables
  6. for this class, all declarations must appear at the beginning of the program
  7. Operations - * / % + -
    1. data type, operand result
    2. integer division
    3. order of operations - what is done first, next (pg - 58)
    4. parenthetical expressions
  8. Widening conversion - Narrowing conversion
    1. Automatic widening 
    2. type casting
    3. order of casting
    4. ramification of using casting when it is better to use the correct types
  9. Powers of two review of homework. Play.java
  10. Other examples Letters2.java, Sale.java