i thought JRE is only for running applets........... but yesterday i was asked some other use or pupose of JRE........
1.so What is the fuction of JRE???
have one more question....plz take it separately:
2. When we write sth like: String s = new String("Test");
i know that in such a case the JVM creates 2 objects, both in the heap, one having handle in String Constant Pool and other having handle in some other table(eg: Local Variable table). I have an understanding regarding how this happens, i'll explain it hereunder, i would be greatful to you all if you can analyse mine, and correct me where i go wrong.....
So here i go... whenever we have such a piece of code, and as soon as the class containing this is loaded, first of all all static content will get initialized. After initialization JVM will skim through the byte code for presence of String Literals. As soon as it finds one, it will create an object in the heap and a reference will be there in String Constant pool. Now when the block or the method containing that line of code(String s = new String("Test") is executed a new object is created in the heap.
this is my understanding....
Plz treat both ques. separately.......Confused about purpose of JRE also
The acronym JRE stands for Java Runtime Environment, and is the basic libaries and support for running existing java applications. It generally comes with support for the plugins that allow applets to be run within a browser. By contrast the JDK (Java Development Kit) also includes tools for compiling and running new java applications (e.g javac the java compiler and the debugger)
hi amit i liked to put some additional point in ur understanding. after the initialization of the static contentthe instance variables(i.e member variables) will be get initialized b4 converting to byte code. the rest is ok to my knowledge.
any comments on my point??
Joined: Mar 05, 2005
no.........instance variables or any non-static initializers are only executed whenever we are calling the constructor of the very same class for object creation......they will not come into picture until and unless there is an object is created..........
ppl out there plz give ur valuable cooments on my original question about he Strings.......