Question: 1. Given the method: public int g(int n) { int sum = 0; for (int i=0; i
1. Given the method:
public int g(int n) {
int sum = 0;
for (int i=0; i sum += i; } return s; } Why can the name sum be given to variables in other methods without confusion? 2. What does the following method do? public static int f(boolean b, int n) { if (b) { System.out.println("false"); } else { System.out.println(b); } return n; }// end of f method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
