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.
|Core Java - Interview Questions and Answers for 'Variable assignment' - 1 question(s) found - Order By Newest|
|Ans. Because when we say y = x, the value of x is copied to another memory location and then y points to that new memory location.|
Unlike object references that once assigned point to same object in memory, value is copied in case of variable assignment.
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  variable assignment|
|What do you mean by "Java is a statically typed language" ?|
|What are the advantages and disadvantages of static variables and static methods ?|
|How does volatile affect code optimization by compiler?|
|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
|What is a Final Variable ?|
|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 ?