Trace the following segment code and write the ouput public class Test { public static void main(String[] args) ( System
Posted: Tue Apr 12, 2022 10:26 am
Trace the following segment code and write the ouput public class Test { public static void main(String[] args) ( System.out.println(compare(10, 5, 30)); //output [A] System.out.println(Compare(9, 12, 11); //output system.out.println(Compare(5, 5, 8)); //output [C] System.out.println(Compare(10, 10, 10)); //output [D] 3 public static int Compare(int x, int y, int z) { if (x <= y && x <= z) return (y + z - x); else if (y <= z && y <= x) return (z + xy); else return (x + y - z); 3 3