What is mean by creating some object will be expensive in java/oop
java, object
Solution
Expensive usually means it'll take a while, but it can also mean it'll take a lot of some other resource, such as memory, bandwidth, hosting budget, disk space, or anything else you'd like to use less of. For example,
new int[1000000000]
will be expensive, because it allocates and zeros an incredible amount of memory.
Problem
I heard this statement many times when reading some java books/articles.My question is very straightforward that when we say that creating some object will be very expensive? Here expensive is for what and at what scenario we should use this term.It would be very easy for me to understand if some one illustrate with small example and how to avoid this?