GeekInterview.com
Series: Subject: Topic:
Question: 7 of 995

Explain Object Construction in simple terms

In Java, object types (i.e., classes) must be explicitly constructed for initialization. Explain object construction. Then, state the name of the mechanism for object destruction, and explain in simple terms how it works.
Asked by: Melll | Member Since Dec-2011 | Asked on: Dec 11th, 2011

View all questions by Melll

Showing Answers 1 - 2 of 2 Answers
Priya

Answered On : Mar 15th, 2012

We can construct the objects for a class by using the new keyword in java.

Suppose take an Employee class and we can construct the objects for this class in the following way.
Employee emp=new Employee();
Constructing the objects means we are allocating the memory for the object which can be used to access the
instance variables and instance methods of the class.with out allocating the memory we cannot access them.

 
            

  
Login to rate this answer.
Priya

Answered On : Mar 16th, 2012

In java Object destruction is automatically done by Garbage Collector which is provided y java run time system.

when ever the scope of the object is over then the memory which is allocated for that object is released by the garbage collector.The programmer no need to do anything explicitly.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.