Question: 1) Using wildcards, write a generic method that counts the number of even numbers in a List. This method should accept Lists with elements that
1) Using wildcards, write a generic method that counts the number of even numbers in a List. This method should accept Lists with elements that inherit from Integer.
2) Write the skeleton of a generic class called MyList. MyList represents a list that can be created to hold elements of type String (or subclasses of String). MyList should have the following methods: add (takes an element as input, returns nothing), remove (takes an element as input, returns nothing), indexOf (takes an element as input, returns an integer index), get (takes an integer index as input, returns an element). The skeleton of the class should contain the class definition (ex: class Test {}) and the method definitions (ex: void testMethod(int testInput)). Writing the implementation for the methods is unnecessary.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
