Define 4 overloaded methods named compute() by considering the following main method:


Exercise 2: Define 4 overloaded methods named compute() by considering the following main method:

public static void main(String[] args)      {
           int a = 5, b = 9, c = -2;                 
            boolean t = true, f = false;                
 // sum of 2 integers
        compute(a, b);
        // sum of 3 integers
        compute(a, b, c);
        // logic or between 2 booleans
        compute(t, f);
        // logic or between 3 booleans
        compute(t, f, f);
  // if the integer is positive returns the boolean as it is, otherwise returns its negative
        compute(a, f);
        compute(-a, f);   }.

 

القوائم الدراسية التي ينتمي لها السؤال

محتاج مساعدة؟ تواصل مع مدرس اونلاين الان!