• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Why JVM is called Virtual

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi ! Friends i will be thankful if anyone tells me why JVM is called virtual machine.
what is role of interpreter and why java is platform independent. I want a brief answer.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi!
JVM is called virtual because it is not a physical device and it does not physically exists.
Role Of Interpreter:
interper interprets the java byte code and executes that byte code.
Why java Platform independent:
lets ake an example of C language.in C ,if u compile the program, an .exe file will be created in which it hard codes the information about the hardware that has been used .so when ever u try to run that .exe file, it checks for the hardware configuration hardcoded in it.so the platform on which u r trying to run the .exe file should match with the information hardcoded.so it is platform dependent.But in java, interpreter sends the request to the operating system about the hardware confiuguration and it looks for equivalent hardware configuration.so it is not neccessory that the hardware configuartion should match with the byte code's configuration.so java platform independent.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Balkumar
JVM is called as virtual.
Because it is not a physical device present in the machine.
Java is platform independent because of this JVM. Because when u compile your java program it creates class file which is called as byte code (which is not native code). JVM reads this byte code and converts this byte code to underlaying OS understandable code.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JVM is called a virtual machine because there is no real hardware which interprets the byte code. If you have done any assembly programming for any microprocessor/microcontroller you will able to understand this. A microprocessor has builtin instruction set to interpret the assemly code. Similarly the JVM is similar to a microprocessor in the sense it has its own instruction set but it implemented in software. That is why it is called a virtual machine,
HTH.
Seenu.
 
If we don't do the shopping, we won't have anything for dinner. And I've invited this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic