How is it that Java can be platform independent?
Java is interpreted rather than compiled. This means it is translated on the machine it is run on at the time it is run. Each machine figures out what it wants to do with the commands Java gives it. (You still have to write a Java interpreter for every different platform you want Java to run on, but that’s a one-shot effort.