Menu
Question Index
...

What will be the output of the following program?

import java.util.*;

public class MinMax
{
    public static void main(String[] args)
    {
        List<String> number = Arrays.asList("1 2 3 8 8 7 4 5 6 9".split(" "));
        List<String> string = Arrays.asList("one Two three Four Seven six one three Four".split(" "));
              
        System.out.println("In number maximum is : " + Collections.max(number));
        System.out.println("In number minimum is : " + Collections.min(number));
              
        System.out.println("In string maximum is : " + Collections.max(string));
        System.out.println("In string minimum is : " + Collections.min(string));
    }
}


In number maximum is : 3
In number minimum is : 4
In string maximum is : three
In string minimum is : Four
In number maximum is : 9
In number minimum is : 1
In string maximum is : Seven
In string minimum is : one
In number maximum is : 9
In number minimum is : 1
In string maximum is : three
In string minimum is : Four
In number maximum is : 8
In number minimum is : 1
In string maximum is : one
In string minimum is : Two
Compilation error or Runtime error

Doubts

Problems

Topic: java.util.Arrays - Class Arrays In Collection Framework

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App