This keyword denotes that the value of a variable cannot be updated, for example when using a constant, like the speed of light.
What is final?
If a recursive method doesn't have a condition to stop the recursions, we get a run-time error called...
What is an infinite loop?
In a method to find the maximum value in an array called "incomes", we initialize the variable holding the maximum to this value...
What is prices[0]?
(or the first element in prices)
What data type do ArrayLists require?
(Which is a reason why wrapper classes and autoboxing are needed)
What are objects of a class?
What is the index of the bottom right element in a 4 x 8 array?
What is [3][7]?
(coordinates ok)
This term refers to writing more than one version of a method using the same name, but different parameters.
What is overloading?
The condition that stops recursive calls.
What is the base case?
Write a "for i" loop condition to traverse the elements in an array of Strings called nbaTeams.
You must be completely accurate
for (int i = 0; i<nbaTeams.length; i++)
Write a "for i" loop condition to traverse the elements in an ArrayList of Strings called nbaTeams, in REVERSE.
You must be completely accurate.
for (int i = nbaTeams.size() - 1; i >=0; i-- )
Write a "for i" loop condition to traverse the elements in an array of Strings called nbaTeams.
You must be completely accurate
Declare and initialize an array called "letters" with these values:
a b c
d e f
What is String letters = {{a,b,c}, {d,e,f}};
The automatic conversion the Java compiler makes between primitive types and their wrapper classes. For example, converting an int to an Integer, or a double to a Double
What is autoboxing?
When tracing recursive methods, first you build the _______and then execute it in _________
What is....stack, reverse
Write an enhanced for loop condition to traverse an array of Animal objects called zoo. (zoo is the array name)
for (Animal beast: zoo)
(local variable name "beast" can vary
While traversing an Arraylist using the condition for (Student warrior : roster), write a condition to check if the current element has the name "Jair"
What is... if (warrior.getName().equals("Jair"))?
Declare a 10 x 5 array of doubles called "prices"
What is double[][] prices = new double[10][5];
This phrase describes the fact that if the first part of an AND conditional is false, the second part is not checked.
What is short circuit evaluation?
Here is an example of this technique, in this case used to override integer division:
(double)10/3
What is typecasting?
An enhanced for loop can traverse an array from beginning to end and access its elements. Name two things it cannot do.
What is modify the array and do anything but go from beginning to end? (answers may vary)
Write a single command that would declare and initialize an ArrayList of Integers called "ages" (you don't need to populate it).
What is ArrayList<Integer> ages = new ArrayList<Integer>();
Write the conditions for a nested enhanced for loop to traverse a 2D array of integers called stuff. You can leave out curly brackets.
for (int[] row: stuff )
for(int column : row)
(local variable names may vary)
This keyword indicates that a private variable value is shared by ALL objects of a class, for example "totalStudents".
What is a static?
This type of method allows us to print an objects information using the command System.out.print().
What is toString()?
Write a command to access the name of a Student object at index i, in an array called roster.
(Assume conventional getter names.)
What is roster[i].getName() ?
Write a command that would set the name of an Animal at index 5 in an arrayList called pets to "Captain".
What is roster.get(5).setName("Captain");
Write the conditions for a nested "for i" loop to traverse a 2D array called stuff. You can leave out curly brackets.
for(int r = 0; r < stuff.length; r++)
for(int c = 0; c < stuff[0].length; c++)