msketchy msketchy
  • 17-12-2017
  • Computers and Technology
contestada

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

Respuesta :

tonb
tonb tonb
  • 18-12-2017
The output is 2. The stuff() function receives a copy of n, changes it but the result is never used.
Answer Link

Otras preguntas

Which answer shows a correct way to divide the word at the end of a line? A. cloth-ing B. clo-thing C. cannot be divided D. clot-hing
How did reconstruction affect daily life in South Carolina.
What is the missing length of a square, if one of the sides is 6? the rest is blank
how do I solve for x : 2(x-5)^2+13=31
What Is The Importance Of Studying Government?
In Medieval England who owned the land people in charge
how to find the area of a tilted square?
between what two consecutive energy levels of a hydrogen atom is there the greatest change in energy?
what is the P(4/5) on two consecutive rolls of a number cube?
A class of 12 girls and 14 boys is going to choose 3 students to represent them in student government. Allie suggested that the first 3 students to arrive in cl