Write a function in Java called factorial()
that will take a positive integer as input and returns its factorial as output.
Search Results
Searching for: multi
Individual Exercises
What is most important to know when attempting to retrieve an element from an array list?
When the index is known, what is the time complexity for accessing an element in an array list?
Write a function in Java that takes the int array arr
and returns a new array with each number being doubled. Be sure to make use of...
Complete this method so it prints out the product of the two parameters.
This method returns the value of the minimum element in the subsection of the array "y", starting at position "first" and ending at...
This method returns the value of the minimum element in the subsection of the array "y", starting at position "first" and ending at...
What type of error found on line 3?
public static int minVal(int[] y, int first, int last) { int bestSoFar = y[first]; // line 1 for (int...
Suppose you try to perform count on items in this array {1, 4, 3, 7, 15, 9, 24} for item ‘4’. What position is item 4 in this array?
What datatype should you use to store a Middle initial?
What is the value of y after this code has run?
int y = 2; y = 10;
What is the value of variable donuts after the following code executes?
int donuts = 6; donuts = donuts + 3; donuts = donuts * donuts;
Which lines contain the fields?
public class Test { private final int SHIRTS = 24; private int numPants= 14; private int tanks =0; public...
Which lines contain the constructor?
public class Test() { private final int SHIRTS = 24; private int numPants= 14; private int tanks =0;...
What is the scope of the variable spicy?
int peper = 7; int cumin = 17; if ((pepper>5) && (cumin < 20)) { int spicy = 10;...
What is the scope of the variable cumin?
int peper = 7; int cumin = 17; if ((pepper>5) && (cumin < 20)) { int spicy = 10;...
What loop would you use to increase the adult years once the age reaches 18?
What value is stored in myInt
after casting happens during the assignment in the second line of code.
double myDouble = 9.55; int myInt =...
What value is stored in myDouble
after casting happens during the assignment in the second line of code?
int myInt = 9; double myDouble =...
You are writing code using a jeroo named amy
. Change the following if-then-else statement by adding a new else-if
so that amy
will turn...
You are writing code using a jeroo named amy
. Change the following if-else-if statement by adding a new else-if
so that amy
will turn...
You are writing code using a jeroo named amy
. Change the following if-else-if statement by changing the third part from an else
only to...
Finish the for loop below. This method should return a string containing the first n
multiples of 3 concatenated together. use a loop...
For this method, create and return a 10x5 array of booleans.
Create a 5x10 array of doubles and set the last location in the third row to 25.3. Return that array.