Question: TestForNulls (30) Write a class TestFor Nulls. The method hasNoNulls that accepts an ArrayList with a wildcard type that returns a value of true

TestForNulls (30) Write a class TestFor Nulls. The method hasNoNulls that accepts an ArrayList with a

TestForNulls (30) Write a class TestFor Nulls. The method hasNoNulls that accepts an ArrayList with a wildcard type that returns a value of true if the ArrayList contains no null elements. Write a main program that tests with two ArrayLists. Create a Random object called randy with a seed of 2 The first ArrayList is of type Integer. It will be populated with 7 random integer values from 6 to 10 inclusive using randy. Then test for a null value using hasNoNulls, printing the result as shown below. Then add a null value at the end of the ArrayList, and retest using hasNoNulls, printing the result as shown below. Then print out the ArrayList as shown The second ArrayList is of type String. It will be populated with a 8 String values that are the concatenation of "XXX" and a random integer from to 17 to 25 inclusive using randy. Test for a null value using hasNoNulls, printing the result as shown below. Then add a null value at index 4 of the ArrayList, and retest using hasNoNulls, printing the result as shown below. Then print out the ArrayList as shown It is true that intArrayL has no null value It is false that intArrayL has no null value [9, 5, 7, 6, 8, 5, 5, null] It is true that stringArrayL has no null value It is false that stringArrayL has no null value [xxx17, xxx24, xxx23, xxx19, null, xxx19, xxx24, xxx20, xxx22]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To complete this task we need to create a TestForNulls class with a method hasNoNulls that works with an ArrayList of a wildcard type Then well write ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!