Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers | ||||
| ||||
Ans. Yes.we cannot access them directly but we can access them using object reference.Static methods belong to a class and not objects whereas non static members are tied to an instance. Accessing instance variables without the instance handler would mean an ambiguity regarding which instance the method is referring to and hence its prohibited. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   oops   static   static methods   java keywords Asked in 1 Companies | ||||
Related Questions | ||||
What are the advantages and disadvantages of static variables and static methods ? | ||||
In which cases , moving methods to utility class could be useful ? | ||||
Can we override static methods ? Why ? | ||||
Why can't we use this in static context ? | ||||
Interface can only have ... | ||||
How can we ensure thread safety in static method ? | ||||
Does java allow overriding static methods ? | ||||
When are static and instance methods resolved ? During compile time or Runtime ? | ||||
Have you ever tried mocking static methods ? | ||||