john price wrote:java.lang.StringIndexOutOfBoundsException: String index out of range: 0
nirjari patel wrote:sName is declared as static, that is one per class. So if I modify sName value in anywhere in the class, will it not be affected ? Thats why I am confused, that when a variable is static, how come the vaue is not affected ?
nirjari patel wrote:String s1 = "hello";
s1 = s1 + " world" ;
when we do this, does s1 refer to a new object ? Does it mean that String which s1 referred to earlier (hello) becomes garbage collectible ?
Jesper de Jong wrote: It will not be easy to understand it, however, because the JVM is a large and very sophisticated piece of software that has been under development for 15 years.
nirjari patel wrote:
public void nameTest(String sName){
sName = sName + " idea ";
//start();
}
nirjari patel wrote:
Now when I am using name in place of sName in nameTest(), sName output is changing as follows
public void nameTest(String name){
sName = name + " idea ";
//start();
}
Himanshu V Singh wrote:
But Method can be accessed via object of the class, why is it so, please guide me with a brief explanation ?
Rob Spoor wrote:The way it works now is pretty good.
Rob Spoor wrote:It does compile the byte-code internally, but when the JVM exits that data is discarded again.
Rob Spoor wrote:Because that means you will have to compile your code for each platform.
Rob Spoor wrote:Or perhaps I understood you wrong. Did you mean that the JVM uses byte-code for each class, but compiles that internally and stores that somewhere to use it for future use?
Rob Spoor wrote: If so, then that has some overhead too. If the class changes the JVM would need to check if the compiled data is still up-to-date.
Rob Spoor wrote:And what about the storage required if the JVM has encountered hundreds of classes?