Java - Write code to get minimum of three integers using nested Math.min method without using if statements


Write code to get the minimum number of three.

You cannot use if statements.


Use nested methods


//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        int a = 42;
        int b = 42;
        int c = 42;
        System.out.println(minimum(a, b, c));
    }//  w ww. j  ava  2  s  .c  o m

    private static int minimum(int a, int b, int c) {
        return Math.min(Math.min(a, b), c);

Related Exercise