aspose file tools
The moose likes Beginning Java and the fly likes Simple Object Question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Simple Object Question" Watch "Simple Object Question" New topic
Author

Simple Object Question

J. Ryan
Greenhorn

Joined: Jul 24, 2006
Posts: 21
I have a simple question about when memory is actually allocated. What is the difference between the following two code snippets?



and



Thanks.
[ June 30, 2007: Message edited by: J Ryan ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24051
    
  13

No difference at all, actually. Instance variable initializers like your "= new Object()" are compiled into the constructors of the class.


[Jess in Action][AskingGoodQuestions]
J. Ryan
Greenhorn

Joined: Jul 24, 2006
Posts: 21
Thanks!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Simple Object Question
 
Similar Threads
How do I add a object (copy) to a que or hashmap, and not a reference?
using this in a class itself
From the office.
Possible Memory Leak ?
From main method to contractor, it is possible?