No no no...you have misinterpreted the meaning of that note.
In your code, you are *NOT* accessing an instance variable of the *CLASS* from within that static method. You are accessing an instance variable of the *OBJECT* that was passed in to the function!!!
*THINK* about it: It wouldn't make any difference WHAT object was passed to the static function. If the member you are referencing is valid, the function could get it.
Example:
Code:
public class Practice {
public static int getAge(Zamboni zamb)
{
return zamb.age;
}
}
What you code is NO DIFFERENT than my example!
It's also POINTLESS code.
There's no reason to pass an instance of the SAME CLASS into a static method of that class.
If you are going to do something like that, WHY is the method static in the first place???
A better way to see the error that the reference is talking about would have been to have coded something like this:
Code:
package source.hibernate.utilities;
public class Practice {
public String name;
public int age;
public static int getAge( ) { return age; }
}
Try *THAT*.