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.
|Java - Interview Questions and Answers|
|Ans. At the beginning of an object's life, the Java virtual machine (JVM) allocates memory on the heap to accommodate the object's instance variables. When that memory is first allocated, however, the data it contains is unpredictable. If the memory were used as is, the behavior of the object would also be unpredictable. To guard against such a scenario, Java makes certain that memory is initialized, at least to predictable default values before it is used by any code.|
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  java   constructor   oops   default constructor   jvm expert|
Try 2 Question(s) Test
|What is a Default Constructor ?|
|Will Compiler creates a default no argument constructor if we specify only multi argument constructor ?|
|Difference between Class#getInstance() and new operator ?|
|Can we create an object if a Class doesn't have any constructor ( not even the default provided by constructor ) ?|
|Does every class needs to have one non parameterized constructor ?|
|Variable of the boolean type is automatically initialized as?|
|In a case where there are no instance variables what does the default constructor initialize?|
|Is it mandatory to have a default constructor ?|
|Why Java doesn't provide a default constructor if we define an argument constructor ?|