This is a loop that can only be used on an array or an iterable collection of items. It will loop through the collection once for each item.
What is a for each loop?
public String[] printNums(int n) {
String[] nums = new String[n];
for(___________){
nums[i]=""+i;
}
return nums;
}
What is int i =0;i<n;i++
The first method that runs in a class before any other method. It allows for the initialization and declaration of variables so that way the variables can be used in the project.
What is a Constructor?
This data type is used to store true or false values.
What is a boolean?
This word is used for the instantiation of an object.
What is new?
This loop will execute its statement once and then continues to execute the statement repeatedly until its condition is met.
What is a Do While loop?
declare and initialize the two-dimensional (2D) String array things.
/* missing code */ = {{"spices", "garlic", "onion", "pepper"},
{"clothing", "hat", "scarf", "gloves"},
{"plants", "tree", "bush", "flower"},
{"vehicles", "car", "boat", "airplane"}};
String[][] things
This is the practice of rewriting a method to accept a different datatype
What is overloading?
This is a data type that stores fractional numbers. Sufficient for storing 6 to 7 decimal digits (4 bytes)
this is the word you need to make a method that doesn't need an object.
What is static?
This is a type of programming loop where a method calls itself until the exit condition is met.
What is recursion?
The method countTarget below is intended to return the number of times the value target appears in the array arr. The method may not work as intended.
public int countTarget(int[] arr, int target)
{
int count = 0;
for (int j = 0; j <= arr.length; j++) // line 4
{
if (arr[j] == target)
{
count++;
}
}
return count;
}
what makes it work as intended?
Changing j <= arr.length; to j < arr.length;
A variable that cannot change once its initial value is assigned.
What is a constant?
This is a data type that stores whole numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (8 bytes)
what is a long?
An object is a ______ of a class.
what is an instance?
This is the name for the last condition in a recursive loop.
What is the base case?
int[] arr = {10, 5, 1, 20, 6, 25};
int sum = 0;
for (int k = 0; k <= arr.length; k++)
{
sum += arr[k];
}
System.out.println("The sum is " + sum);
fix the code segment
The for loop header should be replaced with for (int k = 0; k < arr.length; k++).
This allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes.
What is Overriding?
This variable is not an object reference and can be manipulated to perform tasks with code.
What is a primitive data type?
Who is the best person in this class(declare it as an object person with a boolean argument 'best' that is true.
Person ava = new person(true);
this loop is best to use when asking for user input.
what is while or do-while?
Consider the following code segment, which traverses two integer arrays of equal length. If any element of arr1 is smaller than the corresponding (i.e., at the same index) element of minArray, the code segment should replace the element of minArray with the corresponding element of arr1. After the code segment executes, minArray should hold the smaller of the two elements originally found at the same indices in arr1 and minArray and arr1 should remain unchanged.
for (int c = 0; c < arr1.length; c++)
{
if (arr1[c] < minArray[c])
{
arr1[c] = minArray[c];
}
else
{
minArray[c] = arr1[c];
}
}
What change would ensure that the code segment always works as intended?
Removing lines 5–8
The part of an IDE used to change turn code into software.
what is a compiler?
This is a type of file that has methods that requires a project to implement them into the project. The methods are abstract.
What is an interface?
draw a picture of a duck (if it is deemed good you get the points)
is the drawing is deemed good