1+ import java .util .*;
2+
3+ public class Test {
4+ /** Main method */
5+ public static void main (String [] args ) {
6+ // Create a list of Integers
7+ Integer [] intArray = {new Integer (2 ), new Integer (4 ),
8+ new Integer (3 )};
9+ ArrayList <Integer > intList =
10+ new ArrayList <>(Arrays .asList (intArray ));
11+
12+ // Create a list of Doubles
13+ Double [] doubleArray = {new Double (3.4 ), new Double (1.3 ),
14+ new Double (-22.1 )};
15+ ArrayList <Double > doubleList =
16+ new ArrayList <>(Arrays .asList (doubleArray ));
17+
18+ // Create a list of Characters
19+ Character [] charArray = {new Character ('a' ),
20+ new Character ('J' ), new Character ('r' )};
21+ ArrayList <Character > charList =
22+ new ArrayList <>(Arrays .asList (charArray ));
23+
24+ // Create a list of Strings
25+ String [] stringArray = {"Tom" , "Susan" , "Kim" };
26+ ArrayList <String > stringList =
27+ new ArrayList <>(Arrays .asList (stringArray ));
28+
29+ // Display the largest element in each list
30+ System .out .println ("Maximum Integer object: " +
31+ Exercise_19_10 .max (intList ));
32+ System .out .println ("Maximum Double object: " +
33+ Exercise_19_10 .max (doubleList ));
34+ System .out .println ("Maximum Character object: " +
35+ Exercise_19_10 .max (charList ));
36+ System .out .println ("Maximum String object: " +
37+ Exercise_19_10 .max (stringList ));
38+ }
39+ }
0 commit comments