X1037: Debug Null Pointer Exception

The following method takes in a list of generic objects and returns the number of items in the list. As written, however, the method will produce a null pointer exception if null is passed in as the parameter value.

Add an if statement to the method that will check for a null parameter value and, if so, return -1 instead of producing a null pointer exception.

Your Answer:

Feedback

Your feedback will appear here when you check your answer.