Ask Question
14 August, 14:40

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

+1
Answers (1)
  1. 14 August, 18:16
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers