Question: What output is produced by the following code? Explain how it works. (20points) 6 public static int ifElseMystery (int a, int b) { 7
What output is produced by the following code? Explain how it works. (20points) 6 public static int ifElseMystery (int a, int b) { 7 8 9 10 11 12 13 14 15 16 17 18 19 20 if (a < b|| b < 0) { a = a + b; 21 22 23 } } else { b = b + a; } return a+b; } public static void main(String[] args) { int a=1; int b=1; a = ifElseMystery (a, b); b= ifElseMystery (b, a); System.out.printf("a=%d b-%d ", a, b); Edit View Insert Format Tools Table 12pt Paragraph B IU A 2 T V
Step by Step Solution
3.45 Rating (148 Votes )
There are 3 Steps involved in it
It seems there might be a formatting issue in your code but Ill make an assumption ab... View full answer
Get step-by-step solutions from verified subject matter experts
