This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes object instantiation VS initialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "object instantiation VS initialization" Watch "object instantiation VS initialization" New topic
Author

object instantiation VS initialization

lavnish lalchandani
Ranch Hand

Joined: Feb 28, 2007
Posts: 79
Hi
What happens first (i) object intialization OR (ii) object instantiation


lavnish.blogspot.com
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
object instantiation involves allocating memory for the new instance to exist,

object initialization involves setting the values of the new instance to an initial state (via calls to the constructors)



which do you think occurs first?


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
How could you possibly initialize an object that didn't exist?

Where did this question come from - another interview question?

If you want to get picky, in one of the first steps in object instantiation the JVM sets the allocated memory to zero so initialization starts then.

Bill
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19675
    
  18

Not an intermediate question


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: object instantiation VS initialization