Question: Type the program's output public class ItemChoice { public static T chooseItem(T item1, T item2, T item3) { T chosenItem = item1; if (item2.compareTo(chosenItem) >

Type the program's output

public class ItemChoice {

public static >

T chooseItem(T item1, T item2, T item3) {

T chosenItem = item1;

if (item2.compareTo(chosenItem) > 0) {chosenItem = item2; }

if (item3.compareTo(chosenItem) > 0) {chosenItem = item3; }

return chosenItem; }

public static void main(String[] args) {

Integer i1 = 8; Integer i2 = 6; Integer i3 = 7;

Character c1 = 'b'; Character c2 = 'y'; Character c3 = 'z';

String s1 = "silver"; String s2 = "khaki"; String s3 = "cyan";

System.out.println(chooseItem(c1, c2, c3));

System.out.println(chooseItem(i1, i2, i3));

System.out.println(chooseItem(s1, s2, s3));

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!