Continuing Java Basics - Intro to decisions
New Terminology
- boolean data type
- values of true/false only. true and false are java keywords
- boolean expression
- An expression whose result is either true or false
- relational operators
- > < == != <= >=
Programming specific structures and terms
- if statement; if else statement
- A statement in java which provides branching or doing one
of two alternative actions
Class notes
- Math class
- "static" methods
- require the use of the name of the class, Math
- cannot instantiate a "Math" object
- methods provide a number of different math functions.
- Conditionals - Conditions.ppt
- Uses of if:
- Validation
- Loop control (later)
- Error prevention
- Defensive coding - if anything can go wrong it will so plan for it.
- Selective operation
- Basic if statement AverageScore.java
- If else statement Chooser.java
- Reading char data. See Chooser.
- Block statements Division.java
- Nested ifs
- Documentation conventions