Pergunta de entrevista da empresa MileStoneOS

What is the purpose of static methods and variables

Resposta da entrevista

Sigiloso

13 de out. de 2020

The methods or variables defined as static are shared among all the objects of the class. The static is the part of the class and not of the object. The static variables are stored in the class area, and we do not need to create the object to access such variables. Therefore, static is used in the case, where we need to define variables or methods which are common to all the objects of the class