How do we create 1000 object in OO PROGRAMMING WITH java. What will be the memory size required?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
How do we create 1000 object in OO PROGRAMMING WITH java. What will be the memory size required?
One way would be to use a loop.How do we create 1000 object
Depends on the size of an object.What will be the memory size required?
Also posted here: https://www.dreamincode.net/forums/t...memory-needed/
and here: https://stackoverflow.com/questions/...bjects-in-java
and here: https://coderanch.com/t/703201/java/...va-efficiently
If you don't understand my answer, don't ignore it, ask a question.
How do we create 1000 objects in java efficiently and what will be the memory overhead in creating these many objects?
You can't do it directly. Java has several methods that give approximations of memory usage that could be used. See the API doc for the Runtime class.
If you don't understand my answer, don't ignore it, ask a question.
if the size of one object is 110 bytes and there are 1000 such objects then how can we efficiently call a method using this object so that minimum memory is required?
It's not important to worry about that.
If you don't understand my answer, don't ignore it, ask a question.