What is the difference between “architecture-neutral” and “portable”?

前端 未结 9 947
忘了有多久
忘了有多久 2020-12-14 12:40

I\'m reading Herbert Schildt\'s book \"Java: The Complete Reference\" and there he writes that Java is portable AND architecture-neutral. What is the difference between this

相关标签:
9条回答
  • 2020-12-14 13:41

    Take a look at this white paper on Java.

    Basically they're saying that in addition to running on multiple environments (because of being interpreted within the JVM), it also runs the same regardless of environment. The former is what makes it portable, the latter is what makes it architecture-neutral. For example, the size of an int does not vary based on platform; it's established by the JVM.

    0 讨论(0)
  • 2020-12-14 13:42

    .class file is portable because it can run on any OS . The reason is , .class file generated by JVM is same for all OS. On the other hand JVM is differ as OS , but it generate same .class file for all OS, so JVM is architectural neutral.

    0 讨论(0)
  • 2020-12-14 13:46

    I suspect that he means that code can run on many platforms without recompilation. It is also possible to write code that deals with the underlying system without rewrites or conditions.

    E.g. Serialized objects from a 32 bit Windows system can be read on a 64bit Linux system.

    0 讨论(0)
提交回复
热议问题