Explain static and this Keywords in Java?

  • Nov 12, 2020
  • 1
  • 1.3k

Explain static and this Keywords in Java?

Answers (1)
Answer Accepted

Java static keyword

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

  • Variables
  • Methods
  • Block

Java this Keyword

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.

 

Submit your answer