Forums Register Login

May be silly question!!

+Pie Number of slices to send: Send
Hi,

It may seems o be a silly question. But, I don't know whom to ask. I have the only source "JAVARANCH".

Often, I come across like this.

Given a program and asking the following questions frequently in the String cases)

Say that the program has just been loaded into main memory and is just about to start running.
How many reference variables are there?
How many objects are there?


Whether it is possible to write the program or already having the program to test the above question.

If we have like this, we can check our pgm, how many objects are created and how many refernces are there?
+Pie Number of slices to send: Send
There aren't silly questions, just silly people.

Actually the best place to find that answer is in the Java Langauge Specification and in the section it talks about the class loader and the JVM how it starts up.

But basically, and this is just a stab, since i never try to memorize this trivia stuff. But the program is starting up, so that it is calling the main method which is static, and does not need an instance. Therefore I would say there are no instance objects created, and therefore also no instance variables created.

But the JVM might have something underneath that only the JLS (Java Spec) will tell you about.

JLS is at java.sun.com

Mark
Could you hold this kitten for a sec? I need to adjust this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 482 times.
Similar Threads
Serialization Unleashed
Why primitive types don't need a new keyword for creation?
disappointed with this list
Garbage Collection
how to know how many objects are unclaimed.?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:45:03.