What is the proper term for --
When used with a variable, it decreases the variable by one. Usually used to keep decreasing a loop by one.
decrement operator
What is one of the most common ArithmeticExceptions in Java?
dividing a number by 0
Name the 3 logical operators and their symbols used to compare Booleans
! Not
&& And
|| Or
What is included when writing parameters?
parameter name and parameter type
What are the 5 types of arithmetic operators you can use in Java?
+ - / % *
addition, subtraction, multiplication, division, modulus
What is the name for a loop that iterates through all elements of a collection?
Hint: for (int value : arrayName)
for each loop or enhanced for loop
When is an IndexOutOfBoundsException occur?
is thrown when an index of some sort is out of range
What does this mean?
if ((x < y) && (p != q))
the test is only true if x is less than AND p is NOT equal to q
Name 4 keywords used in coding.
Think of words that you use consistently and mean the same thing each time regardless of where their used
public, private, class, void, return, static, final
When is floating-point division used? What type of variable must be used for this?
when you want the what's after the decimal recognized
recommended to use doubles
What is the number of times the following loop will be executed:
for(int j = 1; j <= 10; j++)
10
What is a word that applies to ALL of the following:
ArrayIndexOutOfBoundsException, ArithmeticException, NullPointerException
What does this mean?
if((p == q) || (j >= 4))
test will be true if p is equal to q OR j is greater than or equal to 4
only one needs to be true for true result
What block of code is used to create an object of the class? It has no return type and cannot be invoked by a direct method call. It contains the order of parameters used to add value to object creation.
constructor
Solve the equation:
11 - 4 / 3 + 2
12
How many times is the following loop executed?
for(int j = 1; j <= 3; j++)
{ for (int k = 1; k <= 2; k++)
{ doSomething; } }
6
What kind of error occurs during compilation of a program, before execution starts?
compile time error
What is this code segment saying?
if (x == 3) { if ( y < 4 ) { /* action here */ } }
the action will only happen if x is equal to 3 AND y is less than 4
What does the word final in the following code mean?
final int CLASS_SIZE = 25;
class size is set to 25 and cannot be changed
Solve this equation
3 + 4 * 8 / 3 - 12
1
How many times is this nested loop executed?
for (int j = 0; j < 5; j++)
{ for (int k = 1; k < 9; k++)
{ doSomething(); } }
40
What kind of error occurs when index is outside the range of the array?
ArrayIndexOutOfBoundsException
What is another way to write this equation?
if (m <= 20) { if ( n % 2 == 0 ) { /* action here */ } }
if (m <= 20 && n % 2 == 0)
What are the keyword relationship for getter methods and setter methods?
getter: get and return
setter: set, void, variable = parameter
(3 + 4) * 8 / 3 - 12