I just had an interview on my code in a Java Introduction class. An the interviewer asked me, in this method which one is the local variable?
public double lengthOfHypotenuse(double a, double b) {
return Math.sqrt(a * a + b * b);
}
I answered a and b.
He say I am wrong because they are parameters. But am I though? I went and google and see lots of websites that say parameters are local variables. Though in my class's Java resource it defines local variables as this.
Definition: Local variable – A variable that is defined within the body of a method and is accessible within that method only.
So who is correct and who is wrong?