1compiler
Programs for translating programs ("source code") into assembler/machine code
2interpreter
Way to execute a program, taking the source code as input and executing the source directly
3Java
An object-oriented programming language developed in the early 1990s
4What makes Java different from C++?
Java programs are portable between machines as they are compiled into Java bytecode, which can read and executed by a JVM interpreter
5rules for names in Java
must begin with a letter, dollar sign, or underscore; followed by zero or more letters, dollar signs, underscores, or digits
6What is the difference between int, float, and double?
int ranges from -2 billion to 2 billion, only integers
float does real numbers with 7 digits of precision
double does real numbers with 15 digits of precision
7boolean
A one-byte data meaning true or false
8remainder of x divided by y
x % y
9How do you find if string s equals string t?
s.equals(t)
10How do you find the length of string s?
s.length()
11How do you compare string s to string t lexicographically?
s.compareTo(t)
12How do you create a scanner that reads until the next whitespace?
next()
13writing an if statement
if (condition) {
statements;
}
14writing an if-else statement
if (condition) {
statements1 if true
} else {
statements2 if false
}
15What is the logical operator for and? or? not?
and is &&, or is ||, and not is !
16How do you increase/decrease a variable by one? by more than one?
Increase by one: variable++
Decrease by one: variable--
Increase by more than one: variable+=
Decrease by more than one: variable-=
17while loops
While loops contain a statement (body) and a boolean condition
The body is executed as long as the condition is true, and is tested before each execution
18do-while loops
Do-while loops contain a statement (body) and a boolean condition
The body is executed as long as the condition is true, and is tested after each execution
19indefinite iteration loop
tests something that is coming from outside of the loop structure; needs to eventually change from true to false
20counted iteration loop
tests something that is controlled inside the loop; starts at some value and counts up and down until some set ending point
21trace tables
mechanisms to keep track of values in a program; allows you to understand program behavior
22for-loops
a counter is set, the condition is tested before each body execution, and the update is performed at the end of each iteration
written as for (initialization; condition; update) {
23types of methods
static (can be called without creating an object) and non-static (need an object to call them)
24general format for methods
public static (RETURN TYPE) name (PARAMETER LIST) {
25difference between public and private methods
public --> anyone can call/execute the method; private --> only other methods of the class can call the method
26void methods
do not return a value
27parameters
parameters are variables decalred in () following a method name
when a method is called, and before the first statement in the method is executed, the parameters are initialized with any values present in the method being called
28prototype
the first line of a method; provides the return type, name, and parameters
29precedence
which operators take their operands first; higher-precedence rules answer this question (ex. PEMDAS)
30associativity
determines which operators take operators first when operators have the same precedence
two kinds: left-associativity (operators take operands from left to right) and right-associativity (operators take operands from right to left)