| 1. What is the difference between JRE and JVM ?
Answer :
JVM (Java Virtual Machine):-
JVM (Java Virtual Machine) is an abstract
machine. It is a specification that provides runtime environment
in which java byte code can be executed.JVMs are available for
many hardware and software platforms (i.e. JVM is platform
dependent). The JVM performs four main tasks:
• Loads code
• Verifies code
• Executes code
• Provides runtime environment
As we all aware when we compile a Java file,
output is not an ‘exe’ but it’s a ‘.class’ file. ‘.class’file
consists of Java byte codes which are understandable by JVM.
Java Virtual Machine interprets the byte code into the machine
code depending upon the underlying operating system and hardw
-are combination. It is responsible for all the things like ga
-rbage collection, array bounds checking, etc… JVM is platform
dependent. The JVM is called “virtual” because it provides a
machine interface that does not depend on the underlying opera
-ting system and machine hardware architecture. This independe
-nce from hardware and operating system is a cornerstone of th
-e write-once run-anywhere value of Java programs. There are
different JVM implementations are there. These may differ in
things like performance, reliability, speed, etc. These implem
-entations will differ in those areas where Java specification
doesn’t mention how to implement the features, like how the
garbage collection process works is JVM dependent, Java spec
doesn’t define any specific way to do this.
JRE (Java Runtime Environment):-JRE is an acronym for Java Runtime Environment. It is used to provide runtime environment .It is the implement -ation of JVM .It physically exists .It contains set of librar -ies + other files that JVM uses at runtime .Implementation of JVMs are also actively released by other companies besides Su -n Micro Systems. Java Runtime Environment contains JVM,class libraries, and other supporting files. It does not contain any development tools such as compiler, debugger, etc. Actually JVM runs the program, and it uses the class librar -ies, and other supporting files provided in JRE. If you wa -nt to run any java program, you need to have JRE installed in the system. The Java Virtual Machine provides a platfor -m-independent way of executing code; programmers can conce -ntrate on writing software, without having to be concerned with how or where it will run. But, note that JVM itself not a platform independent. It only helps Java to be execut -ed on the platform-independent way. When JVM has to interp -ret the byte codes to machine language, then it has to use some native or operating system specific language to inter -act with the system. One has to be very clear on platform independent concept. Even there are many JVMs written on Java, however they too have little bit of code specific to the operating systems. If u just want to run applets (ex: Online Yahoo games or puzzles), JRE needs to be installed on the machine. |
| 2. what is the purpose of JIT compiler?
Answer :
The JRE features a more robust JVM. Instead of interpreting byte-code, it down-right converts the code straight into equivalent native code for the local system. This process of conversion is called just-in-time compilat -ion or JIT-compilation. This process only occurs when the byte-code is executed for the first time. Unless the byte- code itself is changed, the JVM uses the compiled version of the byte-code on every successive execution. Doing so saves a lot of time and processor effort, allowing applicat -ions to execute much faster at the cost of a small delay o -n first execution. |
| 3. Can we save the java source file without any name?
|
| 4. Can we overload main method ?
Answer :
Yes, we can overload the main method.
|
|
5.Can we create a program without main method ?
Answer :
Yes, we can write a program without main method.
|
Encapsulation,Advantages of using Encapsulation,Implementation of
Encapsulation using java
-
*Encapsulation*
*Binding (or wrapping) code and data together into a single unit is known
as encapsulation*.
For example: A java class is the example of...
12 years ago




