Question: 1)- MyList Class *java using BigDecimal* Write a generic class named MyList, with a type parameter T. The type parameter T should be constrained to
1)- MyList Class *java using BigDecimal*
Write a generic class named MyList, with a type parameter T. The type parameter T should be constrained to an upper bound: the Number class. The class should have as a field an ArrayList of T. Write a public method named add, which accepts parameter of type T. When an argument is passed to the method, it is added to the ArrayList. Write two other methods, largest and smallest, which return the largest and smallest values in the ArrayList. Demonstrate the class in an application.
import java.util.*; import java.math.BigDecimal;
public class MyList
public static T Largest() { }
public static T Smallest() { }
public static
public static void main(String args[]) { } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
