This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "object instantiation VS initialization" Watch "object instantiation VS initialization" New topic

object instantiation VS initialization

lavnish lalchandani
Ranch Hand

Joined: Feb 28, 2007
Posts: 79
What happens first (i) object intialization OR (ii) object instantiation
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 -
if (Posts < 30) JavaRanchFAQ);
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12761
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.

Rob Spoor

Joined: Oct 27, 2005
Posts: 19655

Not an intermediate question

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: object instantiation VS initialization
Similar Threads
Difference between instantiation and initialization objects
Dependency Injection with setter injection ?
diff betwn method and constructer
Singleton or Prototype for DI bean injection?
class accessibility