The method that creates a new object
What is Constructor Method?
ints, doubles, booleans; mutable and stored directly in memory
What are primitive data types?
Loop used when you know the number of iterations
What is a for loop?
int[][] myArray = new int[3][4];
What is creating a 2D array (row 3, col 4)
ArrayList<String> myArray = new ArrayList<>();
What is creation of an ArrayList?
What are access modifiers? (Private, public)
Variable types that must be capitalized and store the memory address of an object rather than the actual data
What are reference variables?
The loop used when you do not know the number of iterations needed
What is a while loop?
String myStr = array[0][1];
What is accessing elements of a 2D array?
.add(), .size(), .get(); .remove(), .set();
What are ArrayList methods?
The data or properties an object holds and the actions that the object performs
What is behavior and state?
The conversion of one data type to another (int to double, double to int)
What is casting?
A variation of a for loop that automatically loops through every value of an array
what is an enhanced for loop/for each loop?
for (int i = 0; i < array.length; i++)
{
for (int j = 0; j < array[0].length; j++)
{
//do something
}
}
What is row-major traversal?
The main difference between ArrayLists and regular arrays
What is change in size after creation?
Variables that only exist in an object class and are specific to each object
What are instance variables?
The object form of primitive data types; used for ArrayLists and built-in operations
What are wrapper classes? (Integer, Double)
int [] array = {5, 7, 9, 10, 11, 12, 45, 73, 13};
int myInt = arrray[0];
for (int i = 0; i < array.length; i++)
{
if (myInt < array[i])
{
myInt = array[i];
}
}
return myInt;
---------------------------------------------
The aim of this algorithm
what is finding the max value of an array?
An alternative way to traverse a 2D array (row-major)
What are nested enhanced for loops (for each loops)?
The most effective way to remove elements from an ArrayList using a loop
What is traversing an ArrayList backwards?
Constructor methods that have the same name as another method, but with different parameters
What is an overloaded constructor?
int myInt = (int) (Math.random() * 10) + 1;
What is creating a random number from 1-10, inclusive?
what is concurrent modification error?
int i = 0
int mystery = 0;
for (int j = 0; j < array.length; j++)
{
mystery += [i][j]
}
}
-----------------------------------------
The aim of this algorithm
what is adding up the first elements in every row?
ArrayList<Integer> numbers = new ArrayList<>();
for (int i : numbers)
{
//do something
}
------------------------------------
The outcome of executing this code segment
What is incompatible type error (cannot compile)?