Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
> I have to create 10 objects in a for loop. I am considering to do it in two ways. One is explicitly create the object with new operator. The second one is to create the object with new operator once and clone it 9 times. (Of cource I will call the setXXX methods of the class to change the values after cloning). Which stategy is better? Creating 10 times with new or cloning the object. > for (loop:10 times) { > OR > x x1 = new x(); > for (loop:9 times) { > Please advise.
http://developer.java.sun.com/developer/JDCTechTips/2001/tt0306.html
Replies: |
Sponsored Links
|