What is JVM ? use of JVM?
Answers were Sorted based on User's Feedback
Answer / sathish s t
JVM is (java virtual machine) the piece of software that is responsible for running java programs.
uses:
JVM is an interpreter that converts your byte code (.class file ) into machine code
| Is This Answer Correct ? | 17 Yes | 1 No |
Answer / srikanth
jvm stands for java virtual machine
jvm is a machine which is mainly responsible for providing
development and runtime envirment
responsible for converting byte to native code
responsible for allocating memory and deallocating memory
responsible for achiving flatform independent
| Is This Answer Correct ? | 7 Yes | 2 No |
Answer / jaseer v
Provide runtime and developing environments,
It is a machine on machine
Explain code to byte code(compile)
Platform independent.........
| Is This Answer Correct ? | 6 Yes | 4 No |
Answer / latha
java virtual machine is tha heart of tha java program. it
is responsible for the .class file and converting byte code
instruction into the machine lang.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / vinaya paluru
JVM stands for Java Virtual Machine. Its the environment in which java programs are executed.Its a software implemented on non-virtual hardware and on standard operating systems."Write once, run anywhere" is achieved by JVM. It accepts form of computer intermediate language commonly referred as java byte code
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / paul
The Java Virual Machine (JVM) is essentially an interpreter
at its core.
It was designed that way for cross platform compatibility.
i.e. write code once, run anywhere. This was the motto in
the early days. The interpreter takes a .class file and
compiles it in a process called Just In Time (JIT)
compiling. So a programmer doesn't have to worry (as much)
about the code being executed. Take C/C++ files which are
executable files (native code - .exe, .dmg etc.). They
don't need to be interpretd but an exe file for Windows
can't work on say Mac. As long as a Java interpreter has
been written for an OS, the .class file will run.
Because .class files are independent of the machine (at
least the classical 32 and 64, XXX bit machines we have
today) they are essentially vitual executables. They still
need the interpreter (JVM) to read them and execute them.
So .class files are essentially virtual bytecode.
Because they are compiled to this intermediate
representation, they are in effect in a language of their
own - Java bytecode. This means that you can in practice
create your own programming language fron end and target it
to the JVM (many do this eg. Scala,) There are over 100
languages that target the JVM as of writing. They do this
becuase they can avoid writing a backend. The JVM is the
backend, and it's a reliable industrial-grade backend.
So nowadays, the JVM is also like a laboratory for testing
new languages and profiling language performance and
reliability etc.
At it's heart the JVM is essentially a stack processor as
it reads the stack of commands in a .class file.
The name is confusing as the only vurtual things are
the .class files that are created by the Java compiler.
It's better imo to think of the Java compiler (Javac) as a
virtual compiler, and the the Java interpreter (JVM) as an
interpreter. Really both stages - compiling and
interpreting are virtual I guess.
The JVM for this reason is also a good way to learn about
abstract machines (as its basically a window into the
intermediate language). There are many uses for the JVM. I
believe virtual machines like this are timeless technology
and will be around, forever maybe.
| Is This Answer Correct ? | 1 Yes | 0 No |
Question 5 [15] Consider the following classes, illustrating the Strategy design pattern: import java.awt.*; abstract class Text { protected TextApplet tA; protected Text(TextApplet tApplet) { tA = tApplet; } abstract public void draw(Graphics g); } class PlainText extends Text { protected PlainText(TextApplet tApplet) { super(tApplet); } public void draw(Graphics g) { g.setColor(tA.getColor()); g.setFont(new Font("Sans-serif", Font.PLAIN, 12)); g.drawString(tA.getText(), 20, 20); } } class CodeText extends Text { protected CodeText(TextApplet tApplet) { super(tApplet); } public void draw(Graphics g) { g.setColor(tA.getColor()); g.setFont(new Font("Monospaced", Font.PLAIN, 12)); g.drawString(tA.getText(), 20, 20); } } public class TextApplet extends java.applet.Applet { protected Text text; protected String textVal; protected Color color; public String getText() { return textVal; } public Color getColor() { return color; } public void init() { textVal = getParameter("text"); String textStyle = getParameter("style"); String textColor = getParameter("color"); if (textStyle == "code") text = new CodeText(this); else text = new PlainText(this); if (textColor == "red") color = Color.RED; else if (textColor == "blue") color = Color.BLUE; else color = Color.BLACK; } public void paint(Graphics g) { text.draw(g); 10 } } The Text class is more complicated than it should be (there is too much coupling between the Text and TextApplet classes). By getting rid of the reference to a TextApplet object in the Text class and setting the colour in the paint() method, one could turn the Text class into an interface and simplify the strategy classes considerably. 5.1 Rewrite the Text and PlainText classes to do what is described above. (6) 5.2 Explain the consequent changes that are necessary to the TextApplet class. (4) 5.3 Write an additional strategy class called FancyText (to go with your simplified strategy classes) to allow fancy text to be displayed for the value "fancy" provided for the style parameter. It should use the font Font ("Serif", Font.ITALIC, 12). (3) 5.4 Explain what changes are necessary to the TextApplet class for this. (2)
if we give input as " hi how are you" then the output should be "uoy woh"...it should skip odd words in the input and should reverse even words from the end of string...can anyone help me to write this program in java
how to handle exceptions in ejb?
What's the purpose of static methods and static variables?
what is the use of abstract class?
3 Answers Amdocs, Atos Origin, Invictus,
What is finally in Java?
Why ArrayList class is not a synchronized class and why it is not a thread safe class? explain
What's the access scope of protected access specifier?
Is 64bit faster than 32 bit?
Which package has light weight components?
What is meant by inheritance and what are its advantages?
What is %d in printf?