ThisExistsInStaticMethod

Misconception:

this is a special local variable, stored in the stack frame of any static method.

Incorrect

this is a local variable, also in static methods

Correct

this does not exist in static methods

Correction
Here is what's right.

this is a special kind of local variable that only exists in instance methods. It refers to the object the instance method is operating on. A static method does not operate on an object, and thus a this variable makes no sense in that case.

Symptoms
How do you know your students might have this misconception?

  • When drawing stack frames of static methods, students include this

Stay up-to-date

Follow us on  twitter to hear about new misconceptions.