my dog learned polymorphism
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What is the function of JRE ????? and Strings??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What is the function of JRE ????? and Strings???" Watch "What is the function of JRE ????? and Strings???" New topic

What is the function of JRE ????? and Strings???

Amit Das
Ranch Hand

Joined: Mar 05, 2005
Posts: 206
i thought JRE is only for running applets...........
but yesterday i was asked some other use or pupose of JRE........ 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
Rahul Bhosale
Ranch Hand

Joined: Mar 10, 2005
Posts: 77
Well, it true that to run an applet it requires a JRE but thats a plug-in.

To run any Java program, (JSPs,Servlets, Talibs, EJB, Swing etc) require a JRE.

Marcus Green
arch rival

Joined: Sep 14, 1999
Posts: 2813
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)


SCWCD: Online Course, 50,000+ words and 200+ questions
Parameswaran Thangavel
Ranch Hand

Joined: Mar 01, 2005
Posts: 485
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??
Amit Das
Ranch Hand

Joined: Mar 05, 2005
Posts: 206
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.......
I agree. Here's the link:
subject: What is the function of JRE ????? and Strings???
It's not a secret anymore!