Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please complete the bolded FIXME's. Thanks! public class Generics{ public static void main(String[] args) { Integer[] intArray = {5, 3, 100, 27, 81, 4, 35};

Please complete the bolded FIXME's. Thanks!

public class Generics{ public static void main(String[] args) { Integer[] intArray = {5, 3, 100, 27, 81, 4, 35}; Double[] doubleArray = {1.28, 5.3, 7.9, 0.5, 0.3, 2.8}; Character[] charArray = {'H', 'E', 'L', 'L', 'O'}; System.out.println(maxElement(intArray)); System.out.println(maxElement(doubleArray)); System.out.println(maxElement(charArray)); System.out.println(); System.out.println(minElement(intArray)); System.out.println(minElement(doubleArray)); System.out.println(minElement(charArray)); System.out.println(); printArray(intArray); System.out.println(); printArray(doubleArray); System.out.println(); printArray(charArray); System.out.println(); } /*FIXME(1) Implement static method maxElement() which takes a T[] array as argument, and returns the maximum element in the array. Note that T extends Comparable*/ /*FIXME(2) Implement static method minElement() which takes a T[] array as argument, and returns the minimum element in the array. Note that T extends Comparable*/ public static > void printArray(T[] array){ for(int i = 0; i < array.length; i++) { System.out.println(array[i]); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

Learn about HRM challenges in the textile industry.

Answered: 1 week ago