Explain static and this Keywords in Java?
Explain static and this Keywords in Java?
The static
keyword in Java is used for the purpose of defining a member to belong to a class rather than an instance. By member we mean
this
keyword is a reference variable that refers to the current object. Anywhere inside the definition of class, it can be used as an individual, and in association with variables, methods, and constructor. The intent of this
is to provide an extra layer of specification and clarity in case the same name is used to avoid any confusion.
A detailed explanation of static
and this
Keywords, please visit static and this Keywords in Java With Examples tutorial.