Search Interview Questions
| 3358 questions in repository.|
There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
|Java - Interview Questions and Answers|
|Ans. Though Static methods cannot access the instance variables directly, They can access them using instance handler.|
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  static   static method   java   oop   variables Asked in 1 Companies basic   frequent|
|What are the advantages and disadvantages of static variables and static methods ?|
|Can we declare static variables as transient ?|
|Can we access instance variables within static methods ?|
| Which of the following can be marked static ?|
a. Methods , Variables and Initialization Blocks.
b. Methods , Variables , Initialization Blocks and Outer Classes and nested Classes.
c. Methods , Variables , Initialization Blocks and Outer Classes.
d. Methods , Variables , Initialization Blocks and nested Classes
|Can we serialize static variables ?|
|What are the disadvantages of using arrays ?|
| Why are Getter and Setter better than directly changing and retrieving fields ?|
What is the significance of variable hiding in Java ?
Why it's preferred to keep variables private and allow their access through getter and setter methods ?
|What are different types of variables a class can have ?|
|When we say final x = 10, is the reference final or the value ?|
|When are static variables loaded in memory ?|