i am unable to understand WHAT MAKES THE BYTECODE IN JAVA, MACHINE INDEPENDENT.
I mean how does the bytecode built after compilation becomes machine independent, or what are the properties that make the bytecode machine independent?

EXAMPLE:-
If i compiled a program on a x86-64 machine and after sometime i executed that class file(bytecode) on a SPARC machine, how is the bytecode able to execute on that machine?

PLEASE HELP............

Think of the JVM as a universal VM. JVM byte code is to JVM what x86 assembly is to x86 family of processors (sort of) with the difference being that this byte-code is not aimed at any specific processor architecture but rather a VM which runs on a variety of architectures.

The platform specific stuff is taken care by the different "JVM implementations" which are tasked with taking in the "platform independent" byte-code and translating it to the corresponding platform specific machine code. Here, the JVM installed on your machine performs the job of the translator; translating a machine independent "code" to machine specific code.

commented: person has a lot of knowledge about the subject +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.