Ask Question
26 June, 05:13

What is output by the following code?

public static void stuff (int w) {

w - = 2;

}

public static void main (String a[]) {

int n = 2;

stuff (n);

System. out. print (n);

}

1. 0

2. 4

3. 1

4. 3

5. 2

+5
Answers (1)
  1. 26 June, 09:01
    0
    The output is 2. The stuff () function receives a copy of n, changes it but the result is never used.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What is output by the following code? public static void stuff (int w) { w - = 2; } public static void main (String a[]) { int n = 2; stuff ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers