Quantcast
Channel: Should we avoid object creation in Java? - Software Engineering Stack Exchange
Viewing all articles
Browse latest Browse all 15

Answer by Alex for Should we avoid object creation in Java?

$
0
0

There's more to creating a class than allocating memory.There's also initialization, I'm not sure why that part is not covered by all the answers.Normal classes contain some variables, and do some form of initialization, and that isn't free. Depending on what the class is, it may read files, or do any other number of slow operations.

So just consider what the class constructor does, before figuring if it's free or not.


Viewing all articles
Browse latest Browse all 15

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>