Summary
- Learned about 3 primitive types
int
double
boolean
- The 3 types on the exam
- Learned how to declare, initialize, and change the value of a variable
- Learned about operators and casting
- Learned about range of possible integer values
Concepts: 1.7.1
- Compiler
- Software to translate source code into something which can be run by a computer
- Compiler/Syntax Error
- An error found during compilation
- Main method
- The method which Java executes on runtime
- Variable
- A name associated with a memory location
- Variable declaration
- Specifying the type and name for a variable
- Sets aside memory for a variable of that type
- Associates the name with a memory location
- Variable initialization
- Giving a value to a variable for the first time
- data types
- determines the size of memory reserved for a variable
int
,double
,boolean
- integer
- whole number
2
,-3
, etc.
- boolean
- An expression of
true
orfalse
- An expression of
- camelCase
- A variable naming scheme
- appending words together, making the first letter of every word after the first uppercase
leftMotor1
,getRequestQueue
,hasAnswer
- Casting
- Changing the type of a variable using
(int) 1.2
,(char) 33
- Operator
- Common mathematical symbols
+
,-
- Compound assignment/shortcut operators
- Operators like
x++;
to shorten longer common expressions x++
->x = x + 1
- Operators like
- modulo
- returns the remainder of one number divided by another
%
- arithmetic expression
- sequence of operands and operators in a calculation
- 3 * (2 + x)
- operator precedence
- The order of operations
*
,/
and%
come before+
and-
Keyword summary: 1.7.2
- boolean
- datatype for a variable which can be only
true
orfalse
- datatype for a variable which can be only
- double
- datatype for a variable which is a decimal number
3.68
- int
- datatype for a varible which is an integer number
3
System.out.print()
- Prints the arguments provided to
stdout
- Prints the arguments provided to
System.out.println()
- Same as
System.out.print()
, but appends a newline to the end of the output
- Same as
=
- assigns the value on the right to the variable on the left
*
,/
,%
,+
,-
- arithmetic operators
Vocabulary practice: 1.7.3
No real notes, just complete the activities
Common mistakes: 1.7.4
- Java is case sensitive
- Forgetting to specify a type during variable declaration
- Forgetting to declare a variable
- Using the incorrect variable name
- Using the incorrect type for a variable
- Integer types give integer results!
1/3
is0
!
- Integer types give integer results!
- Using
==
to compare doubles- Doubles are an approximation and are generally weird
- Assuming a value like
0
will be smaller than other ints- integers can be negative!
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
This was adapted from the CS Awesome curriculum, which was created by
Barbara Ericson, Beryl Hoffman, and many other CS Awesome contributors. All rights reserved.
CS Awesome is licensed under CC BY-NC-SA 4.0.