What does JVM do? (Simple words) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What does JVM do? (Simple words)

7th Aug 2018, 4:29 PM
Nikhil Singh
10 Answers
+ 2
its acts as an interpreter when you compile a java program it turns your code into Bytecode a special language read by the JVM. when you run your program the JVM translates that bytecode into machine code that the computer can understand, the computer does not understand Bytecode and without the JVM a java program would not be able to run. think of it like this, i speak english and say you speak russian i however do not, so we need a third person an interpreter who conveys to you what i am saying in your natural language therefore its not necessary that i learn your language or vice versa.
7th Aug 2018, 4:42 PM
Robert Atkins
Robert Atkins - avatar
+ 2
Nikhil Singh C compilers translate the C code directly to machine language thats why if you want to run it on a different OS you have to use a specific Compiler for it, an analogy for this is i write you a note and then someone rewrites the whole note in your language and then it sends.
8th Aug 2018, 10:20 AM
Robert Atkins
Robert Atkins - avatar
+ 2
Robert Atkins Excellent explanation! 👌
8th Aug 2018, 11:08 AM
Chriptus13
Chriptus13 - avatar
+ 2
Chriptus13 thank you :)
8th Aug 2018, 11:27 AM
Robert Atkins
Robert Atkins - avatar
+ 2
A Java virtual machine (JVM), an implementation of the Java Virtual Machine Specification, interprets compiled Java binary code (called bytecode) for a computer's processor (or "hardware platform") so that it can perform a Java program's instructions.
11th Aug 2018, 10:14 AM
deepak sharma
deepak sharma - avatar
+ 1
Understood. But C doesn't have any JVM of its own How does computer understand our codes then?
7th Aug 2018, 7:08 PM
Nikhil Singh
+ 1
8th Aug 2018, 4:18 PM
Nikhil Singh
+ 1
Robert Atkins Can u also explain why we declare static in main function? (simple words)
8th Aug 2018, 6:31 PM
Nikhil Singh
0
it creates a virtual machine using java
7th Aug 2018, 4:40 PM
Bebida Roja
Bebida Roja - avatar
0
Nikhil Singh static means that the class owns it and uses it when a program runs it calls the main() method of said program, instances of an object occur only within a program therefore its impossible to create an object of the main program and then run its main() method. you can run a static method like so ClassName.methodName() whereas an instance method must be ran CreatedObject.methodName() sorry if that doesnt help you any, if you dont understand what static means in java a quick search will help you understand better what i am saying.
8th Aug 2018, 6:43 PM
Robert Atkins
Robert Atkins - avatar