0%
0 / 10 answered

Methods: How to Write Them Practice Test

10 Questions
Question
1 / 10
Q1

Which statement about method scope is correct for this code? ```java

public class Demo {

public static int factorial(int n){

int prod = 1;

for(int i=2;i<=n;i++){

  int step = i; // loop-only

  prod *= step;

}

return prod;

}

}

Question Navigator