Question: 1. Write a static method that takes an array of integers as a parameter and returns true if the count of strictly positive values is
1. Write a static method that takes an array of integers as a parameter and returns true if the count of strictly positive values is larger than the count of strictly negative values in the array, false otherwise. A number is strictly positive if it is strictly larger than zero (i.e. it cannot equal zero). A number is strictly negative if it is strictly less than zero.
2. Write a static method that takes an array of integers as a parameter and returns back an integer that is the sum of all of the integers in the array.
3. What does this method do? In one short English sentence describe the task accomplished by this method.
| 1 2 3 4 5 6 7 8 9 10 | public static ArrayList { ArrayList for (int i = 0; i < a.size(); i++) { if (a.get(i) < 0) { b.add(i); } } return b; } |
4. What does this method do? In one short English sentence describe the task accomplished by this method.
| 1 2 3 4 5 6 7 8 9 10 11 | public static ArrayList { ArrayList
for (int i = 0; i < a.size(); i++) { if (a.get(i).length() > 10) { tmp.add(a.get(i)); } } return tmp; } |
5. Write a static method named concatenate that takes two ArrayLists of Strings as a parameter and returns a new ArrayList of Strings that contains all of the elements of the first list followed by all of the elements of the second list.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
