What happens if a static method tries to access an instance variable?

Last Updated :
Discuss
Comments

What happens if a static method tries to access an instance variable?


It accesses the instance variable normally

It throws an exception

It results in a compilation error

It works if the variable is final

Share your thoughts in the comments