No, this keyword refers current instance of the class. Static methods do not have instance/object. Hence we can not use this keyword.
Interviews14 answers
Can we use “this” within a static method?
14 Answers
Rajeev KumarPosted Mar 31, 2023, 3:42 AM EDT
The answer is no because static method does not need any object to be called, and this keyword always point to a current object of a class. simply if there is no object then how the keyword point to any current object so,we cannot use this keyword here.
Binod KumarPosted Jun 28, 2019, 2:26 AM EDT
No,This Keyword Refer to Current Insance only, and static method or properties are not belong to any particular instance ,static is common for all insances
kajal ranePosted Apr 4, 2019, 8:55 PM EDT
No
Vipin KumarPosted Mar 29, 2019, 4:13 AM EDT
No bcz we directly call method from class name.
sushil kumarPosted Mar 6, 2019, 11:02 PM EST
no
AKHILESH KUMARPosted Aug 2, 2018, 1:00 PM EDT
No, this keyword refers current instance of the class. Static methods do not have instance/object. Hence we can not use this keyword. We call a static method using ClassName.StaticMethodName
Joy KPosted Jun 7, 2018, 2:15 PM EDT
Static method doesnt allow "this" keyword.
Satish SanaboyinaPosted Mar 15, 2018, 5:51 PM EDT
Static method doesnt allow "this" keyword.
Satish SanaboyinaPosted Mar 15, 2018, 5:51 PM EDT
By static methods you can write:
MyClass.static_method();
Bharathi RajaPosted Jan 31, 2018, 11:38 PM EST
no. this keyword denote instance.....and static method does not support instance
Gajendra JangidPosted Jan 28, 2018, 8:37 PM EST
Technically its not possible , because static portion execute before any other part of code o this keyword will be without referenced
Manav PandyaPosted Jan 16, 2018, 1:04 AM EST
No, this keyword denotes instance variables and functions. In static method, Only static properties initialize.
Kapil GuptaPosted Nov 20, 2017, 9:08 PM EST
No, We can not use, we can only use static variables/methods in a static method.
Pradeep YadavPosted May 24, 2017, 5:35 AM EDT








