Topic | Basic | Intermediate | Advanced |
---|---|---|---|
Expressions |
Identify expressons within a piece of code.
Describe what it means for an expression to have a type?
Identify the type of simple (non-compound) expressions.
Mentally evaluate simple expressions to determine their value.
|
Identify subexpressions within a compound expression.
Identify the types of compound expressions.
Mentally evaluate compound expressions to determine their value.
|
Correctly parenthesize compound expressions based on operator precedence.
|
Data types |
Name the three primitive types we'll use in this course:
int , boolean , and double .Name at least one reference type.
|
Explain the different purposes of the three primitive data types.
|
Explain why it’s important to keep track of the types of expressions.
Explain what “type safety” is.
|
Literal values |
Write basic numeric, boolean, and
String literalsUnderstand the difference between
"true" and true and "false" and false . |
Write
String literals with escape characters: |
Use other forms of numeric literals:
|
Primitive types |
Name the three primitive types we'll use in this course:
int , boolean , and double . |
Explain the different purposes of the three primitive data types.
Describe the set of values represented by the type
int .Describe the set of values represented by the type
double .Describe the set of values represented by the type
boolean .Describe the set of operations that we can apply to
int values.Describe the set of operations that we can apply to
double values.Describe the set of operations that we can apply to
boolean values.Describe the limits on
int values: Integer.MAX_VALUE and Integer.MIN_VALUE and why they have to exist.Explain integer overflow.
|
Explain why it is legal in Java to assign an
int value to a double but not vice versa.Explain how
int s are represented in memory.Explain how
double s are represented in memory.Explain the limitations of
int s and double s relative to pure mathematical numbers.Discuss some surprising consequences of the way
double s work, e.g. why: 0.1 + 0.2 = 0.30000000000000004 |
Reference types |
Name at least one reference type.
|
List the two operators that we learn about that can be applied to reference types:
== and != .Describe the two parts of a value of a reference type (the reference and the actual memory) and how they are related and stored in memory.
Draw a memory diagram of a variable assinged a value of a reference type.
Draw a memory diagram of two variables variable assinged the same value of a reference type.
Understand the concept of
null references. |
Explain how the special reference value
null is representated in memory.Discuss the implications of mutability for reference types.
Understand the concept of aliasing with reference types
|
Arithmetic expressions |
Write single-operator expressions using
+ , - , * , / , and % .Understand the result of casting single values: e.g. what is
(int) 1.3 .Correctly parenthesize compound expressions using the above operators based on their precedence.
|
Write two operator expressions using different combinations of the five operators, parentheses, and homogeneous types (i.e. all
int values or all doubles ).Evaluate expressions involving casts and parentheses to achieve desired results.
Descibe the relationship between integer
/ and % .Use the
% operator to test whether a number is even.Use the cast opeator
(int) to convert double s to int s.Use the cast opeator
(double) to convert int s to double s.Round
double s of known sign (positive or negative) to the nearest int . |
Write multi-operator mixed
int /double expressions with and without parentheses to compute desired double results.Remove redundant casts from arithmetic expressions.
Reorder expressions to avoid the need for casts
Understand that
int division by 0 → ArithmeticException Understand that
double division by 0 → InfinityUnderstand why sometimes
double arithmetic produces NaN . |
Boolean expressions |
Describe some Boolean attributes that people or things can have? (Ignore nuance.)
|
Describe the two values a Boolean expression can have.
|
Describe how boolean expressions are analogous to arithmetic expressions.
|
Logical operators |
Write boolean expressions using one or two variables and one of the logical operators (
! , && , and || ) to achieve a described meaning. |
Write boolean expressions using three or more variables and two or more logical operators to achieve a described meaning.
Draw truth tables for logical expressions.
Properly parenthesize and de-parenthesize boolean expressions involving the three logical operators.
|
Write boolean expressions using a combination of logical and relational operators and variables of various types.
Determine whether different boolean expressions are equivalent by writing a truth table.
Simplify complex boolean expressions.
Apply De Morgan’s Laws to transform boolean expressions involving just logical operators.
Apply De Morgan’s Laws to transform boolean expressions involving relational operators. (Recall that !(a > b) can also be written as a <= b.)
Apply the distributive property to expressions like
a && (b || c) and a || (b && c) Explain short circuiting of
|| and && . |
Equality operators |
Use
== and != to compare primitive values..Explain the difference between
= and == . |
Always simplify the following expressions as shown: x == true ⟹ x x != false ⟹ x x == false ⟹ !x x != true ⟹ !x
|
Explain why it’s importan to always simplify
boolean comparisons as in the previous column.Explain what
== and != do when used with reference types.Understand why relational operators may produce surprising results when used with
double values. |
Relational operators |
Write expressions using relational operators (
== , != , < , > , <= , and >= ) and one variable and one literal to achieve a described meaning. |
Use parentheses correctly to control the order of operations.
Write expressions using relational operators (==, !=, <, >, <=, and >=) and multiple variables to achieve a described meaning.
Chain relational operators with logical operators to translate mathematical expressions like
0 ≤ x < 10 into 0 <= x && x < 10 . |
|
String expressions |
Use
+ to concatenate strings and other valuesWrite code that calls the individual method:
length() , substring(int, int) , substring(int) , indexOf(String) , toUpperCase() , and toLowerCase() correctly, for instance to extract the first character of a string, the last character of a string, or the single character at a particular index. |
Use
+= to build up a string.Write code that calls substring with arguments computed from the results of
length() and indexOf(String) to extract particular parts of a string.Write expressions that uses
equals(Object) and compareTo(String) . |
Write code that combines all the string methods covered and string concatenation to achieve effects such as capitalizing parts of a string, making new strings with substrings excised, and determining whether one string starts or ends with another string or contains another string at a particular position.
|