Computer Science, asked by nidhisaxena383pcovdq, 6 months ago

Specify the class finder with the following overloaded functions:
(i) int findmax(int n1, int n2)
To decide and return the largest from n1 and n2. If both numbers are same, return 0.


(ii) int findmax(int n1, int n2, int n3)
To decide and return the largest from n1, n2 and n3. If all numbers are same, return 0. in java​

Answers

Answered by anonymous516
4

import java.util.*;

public class Main {

public static void main(String[] args) {

findMax(1,3);

findMax(1,3,4);

}

public static void findMax(int n1, int n2)

{

System.out.println(Math.max(n1,n2));

}

public static void findMax(int n1, int n2, int n3)

{

System.out.println(Math.max(n1,n2, n3));

}

}

Similar questions