Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

May be silly question!!  RSS feed

 
Mark Henryson
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!