'static' methods cannot refer to 'this' keyword

'Static' methods cannot use 'this' keyword.

Lets try to use 'this' keyword in 'static' methods by implementing this on Eclipse IDE:

 1. Create 'ThisDemo' class under a project as shown below:


2. Create 'static' specified instance variables 'width', 'height' and 'depth' as shown below:


3. Create 'static' specified method 'setDimensions( )' containing the parameters same as instance variable of this class (i.e. width,  height and depth) and this 'static' specified method tries to use 'this' to differentiate the instance variables from the parameters of this method as shown below:


Observe that errors are displayed in the statements that are using 'this' keyword

4. Hover the mouse over the 'this' keyword in any of the above statements as shown below:


After looking at this error 'Cannot use this in static context', its very clear that we cannot use 'this' keyword in a static method.