Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Java Programs A Back To Basics Approach

Authors: Stuart Reges, Marty Stepp

5th Edition

013547194X, 978-0135471944

More Books

Students also viewed these Programming questions